N, M = map(int, input().split())
s = [0] * M
c = [0] * M
A = [0] * N
X = 0
for i in range(M):
    s[i], c[i] = map(int, input().split())
    if s[i] == 1:
        if c[i] == 0:
            X += 1
    for k in range(i):
        if s[k] == s[i]:
            if c[k] != c[i]:
                X += 1

    A[s[i]-1] = c[i]
if N != 0:
    if A[0] == 0:
        A[0] = 1


Y = map(str, A)
Z = ','.join(Y)


if X == 0:
    print(int(Z.replace(',', '')))
else:
    print(-1)
