Problem

Source: Ukraine 1999 Grade 10 P4

Tags: number theory, game



Two players alternately write integers on a blackboard as follows: the first player writes $a_1$ arbitrarily, then the second player writes $a_2$ arbitrarily, and thereafter a player writes a number that is equal to the sum of the two preceding numbers. The player after whose move the obtained sequence contains terms such that $a_i-a_j$ and $a_{i+1}-a_{j+1}~(i\ne j)$ are divisible by $1999$, wins the game. Which of the players has a winning strategy?