Pregunta de entrevista de AMD

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