N, M = map(int, input().split())
s = []
c = []
for i in range(M):
  si, ci = map(int, input().split())
  s.append(si)
  c.append(ci)
#print(s, c)

for i in range(M):
  if s[i] == 1 and c[i] == 0:
    print(-1)
    exit()
  
for i in range(M):
  for j in range(M):
    if i != j and s[i] == s[j] and c[i] != c[j]:
      print(-1)
      exit()
  
num = [1] +[0]*(N-1)
for i in range(M):
  num[s[i]-1] = c[i]
  
print(num)