a = input().split()
a = [int(s) for s in a]
c = [10] * a[0]
b = [input().split() for i in range(a[1])]
b = [[int(s) for s in row]for row in b]
flag = 0
for i in range(a[1]):
  if c[b[i][0]] == 10:
    c[b[i][0]] = b[i][1]
  elif c[b[i][0]] != b[i][1]:
    flag = 1
if c[0] == 0:
  flag = 1
elif c[0] == 10:
  c[0] = 1
if flag = 0:
  for i in c[1:]:
    if i == 10:
      i = 0
print(c)