Amanda and Liam are shelving books at a public library. Amanda shelves 12 books at a time, whereas Liam shelves 8 at a time. If they end up shelving the same number of books, what is the smallest number of books each could have shelved?