output_description: Print the answer.
  
  * * *
input_description: Input is given from Standard Input in the following format:
  
      
      
      N M
      s_1 c_1
      \vdots
      s_M c_M
attempt: a = input().split()
  N = int(a[0])
  M = int(a[1])
  sc = []
  
  for r in range(M):
      sc += input().split()
  
  insect = [int(i) for i in sc]
  ans = [10, 10, 10]
  
  for r in range(M):
      if ans[insect[2 * r] - 1] == 10:
          ans[insect[2 * r] - 1] = insect[2 * r + 1]
      elif ans[insect[2 * r] - 1] != insect[2 * r + 1]:
          ans[insect[2 * r] - 1] = 11
  
  if ans[0] == 11 or ans[1] == 11 or ans[2] == 11:
      print("-1")
  elif (
      ans[0] == 0
      and N == 3
      or ans[0] != 0
      and N < 3
      or ans[1] == 0
      and N == 2
      or ans[1] != 0
      and N < 2
  ):
      print("-1")
  else:
      for i in range(3):
          if ans[i] == 10:
              if 3 - i == N:
                  ans[i] = 1
              else:
                  ans[i] = 0
      print(100 * ans[0] + 10 * ans[1] + ans[2])
  
problem_description: Statement
  
  If there is an integer not less than 0 satisfying the following conditions,
  print the smallest such integer; otherwise, print `-1`.
  
    * The integer has exactly N digits in base ten. (We assume 0 to be a 1-digit integer. For other integers, leading zeros are not allowed.)
    * The s_i-th digit from the left is c_i. \left(i = 1, 2, \cdots, M\right)
samples: [{"input": "3 3\n    1 7\n    3 2\n    1 7", "output": "702\n    \n\n702 satisfies the conditions - its 1-st and 3-rd digits are `7` and `2`,\nrespectively - while no non-negative integer less than 702 satisfies them.\n\n* * *"}, {"input": "3 2\n    2 1\n    2 3", "output": "-1\n    \n\n* * *"}, {"input": "3 1\n    1 0", "output": "-1"}]