Pergunta de entrevista da empresa AMD

Can you explain how to make this function using only nand gates?