Broken Device 2

아직 제출이 없습니다시간 제한2초메모리 제한512 MB

문제

Anna and Bruno are gamble masters. They will play a game with D-taro who is the dealer of the game.

In this game, Anna and Bruno stay in different rooms. They can communicate with each other using a broken device only. D-taro gives an integer to Anna. For Anna and Bruno, the purpose of this game is to send the given integer from Anna to Bruno using the device.

When the game starts, in the beginning, Anna declares an integer mm between 11 and 2,0002\\,000, inclusive. Then they play QQ rounds. The round ii (1iQ1 ≤ i ≤ Q) is performed as follows.

  1. D-taro gives an integer A_iA\_i to Anna.
  2. Anna inputs arrays s_is\_i, t_it\_i into the device. Every element of the arrays s_is\_i, t_it\_i should be either 00 or 11. The arrays s_is\_i, t_it\_i should have the same length, and the length is between 11 and mm, inclusive.
  3. Let u_iu\_i be an array obtained from the arrays s_is\_i and t_it\_i by riffle shuffle (see below). Then the device sends u_iu\_i to Bruno.
  4. Bruno sends an integer to D-taro. If this integer is the same as the integer A_iA\_i given by D-taro to Anna, Anna and Bruno win for this round.

Write programs which implements the strategies of Anna and Bruno so that theory win for all the Q rounds.

제한

  • 1Q1,0001 ≤ Q ≤ 1\\,000.
  • 1A_i1,000,000,000,000,000,0001 ≤ A\_i ≤ 1\\,000\\,000\\,000\\,000\\,000\\,000 (=1018= 10^{18}) (1iQ1 ≤ i ≤ Q).