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


ans = -1
for i in range(10**(n-1), 10**n):
    for s, c in sc:
        if str(i)[s-1] != str(c):
            break
    else:
        ans = i
        break
if n == 1:
    if m == 0:
        ans = 0
    else:
        for s, c in sc:
            if s == 1 and c == 0:
                ans = 0
                break
print(sc)
