import sys
 
N,M = map(int,input().split())
s = []
c = []
if M >= 1:
    for i in range (M):
        s,c = map(int,input().split())
        s.append(s)
        c.append(c)
    
    for i in range(M):
        if s[i] == 1 and c[i] == 0:
            print("-1")
            sys.exit()
a = zip(s, c)
a.sort()
s, c = zip(*a)
s = list(s)
c = list(c)
    if M >= 2:
        for i in range(1,M):
            if s[i - 1] == s[i] and c[i - 1] != c[i]:
                print("-1")
                sys.exit()
        if s[M - 1] == s[M] and c[M - 1] != c[M]:
            print("-1")
            sys.exit()
    for i in range(M):
        cc = [0] * N
        cc[s[i] - 1] = c[i]
    for i in range(min(s[i])):
        cc[i] = 1
    print(cc)
if M == 0:
    cc = [0] * N
    cc[0] = 1
    print(cc)