Learning long-term dependencies using layered graph neural networks