Recurrent Neural Networks Learn to Store and Generate Sequences using Non-Linear Representations