Let a1,a2,a3,a_1, a_2, a_3, \ldots be an infinite sequence of positive integers, and let NN be a positive integer. Suppose that, for each n>Nn > N, ana_n is equal to the number of times an1a_{n-1} appears in the list a1,a2,,an1a_1, a_2, \ldots, a_{n-1}.

Prove that at least one of the sequences a1,a3,a5,a_1, a_3, a_5, \ldots and a2,a4,a6,a_2, a_4, a_6, \ldots is eventually periodic.

(An infinite sequence b1,b2,b3,b_1, b_2, b_3, \ldots is eventually periodic if there exist positive integers pp and MM such that bm+p=bmb_{m+p} = b_m for all mMm \geq M.)