N,M=map(int,input().split())
a=[]
ans=["a"]*N
for _ in range(M):
    a.append(list(map(int,input().split())))
for i in range(M):
    ans[a[i][0]-1]=a[i][1]
for j in range(N):
    if type(ans[j])!=int:
        ans[j]=0
if ans[0]==0:
    print(*ans[1:3],sep="")
elif ans[0]==0 and ans[1]==0:
    print(*ans[2:3],sep="")
else:
    print(*ans,sep="")