#AGC056C. [AGC056C] 01 Balanced

[AGC056C] 01 Balanced

Score : 900900 points

Problem Statement

Consider making a string ss of length NN consisting of 0 and 1, where ss must satisfy MM conditions. The ii-th condition is represented by integers LiL_i and RiR_i (1Li<RiN1 \leq L_i < R_i \leq N). This means that there should be equal numbers of 0 and 1 between the LiL_i-th and RiR_i-th characters (inclusive) of ss.

Find the lexicographically smallest string ss that satisfies all conditions. It can be proved that the Constraints of the problem guarantee the existence of ss that satisfies the conditions.

Constraints

  • 2N1062 \leq N \leq 10^6
  • 1M2000001 \leq M \leq 200000
  • 1Li<RiN1 \leq L_i < R_i \leq N
  • (RiLi+1)0mod2(R_i-L_i+1) \equiv 0 \mod 2
  • (Li,Ri)(Lj,Rj)(L_i,R_i) \neq (L_j,R_j) (iji \neq j)
  • All values in input are integers.

Input

Input is given from Standard Input in the following format:

NN MM

L1L_1 R1R_1

L2L_2 R2R_2

\vdots

LML_M RMR_M

Output

Print the answer.

4 2
1 2
3 4
0101
6 2
1 4
3 6
001100
20 10
6 17
2 3
14 19
5 14
10 15
7 20
10 19
3 20
6 9
7 12
00100100101101001011