NOT and AND can be built using NAND gates, and therefore all logic gates can be built using NAND gates. Just google "all logic gates using NAND" to see how to do it.