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())
    for k in range(i):
        if s[k] == s[i]:
            if c[k] != c[i]:
                X += 1

    A[s[i]-1] = c[i]

if A[0] == 0:
    A[0] = 1


Y = map(str, A) #格納される数値を文字列にする
Z = ','.join(Y)


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