N, M = map(int, input().split())
S = []
C = []
for _ in range(M):
    s, c = map(int, input().split())
    S.append(s-1)
    C.append(c)

for i in range(1000):
    tmp = str(i)
    if len(tmp) != N:
        continue
    flag = True
    for j in range(M):
        if tmp[S[j]] != str(C[j]):
            flag = False
    if flag:
        print(tmp)
        break