n, m = map(int,input().split())
sc = [list(map(int,input().split())) for i in range(m)]

num = [-1]*n

ans = True

for i in range(m):
    if num[sc[i][0]-1] == -1:
        num[sc[i][0]-1] = sc[i][1]
    elif num[sc[i][0]-1] == sc[i][1]:
        continue
    else:
        ans = False
        
if num[0] == 0:
    if len(num) > 1:
        ans = False
    elif len(num) == 1:
        ans = True
else:
    for i in range(n):
        if num[i] == -1:
            if i == 0:
                if len(num) > 1:
                    num[i] = 1
                else:
                    num[i] = 0
            else:
                num[i] = 1
if ans:
    print(*num)
else:
    print('-1')
            