a = []
a = input().split()
N = int(a[0])
M = int(a[1])
b = []
s = []
c = []
for i in range(M):
  b = input().split()
  s.append(int(b[0]))
  c.append(int(b[1]))
  b.clear()
#print('N=', N, ' M=', M)
#print('s=', s)
#print('c=', c)

numb = [0 for i in range(N)]
#print('numb=', numb)

count = [0 for i in range(N)]

for i in range(M):
  if numb[s[i]-1] != c[i]:
    count[s[i]-1] += 1
    numb[s[i]-1] = c[i]
    if count[s[i]-1] > 1:
      print(-1)
      exit()
#print('numb=', numb)
#print('count=', count)
if numb[0] == 0:
  print(-1)
  exit()

numb = [str(i) for i in numb]
mozi = ' '
for x in numb:
  mozi += x

print(int(mozi))


