Buggy python submission (verdict: Runtime Error):
import sys
N,M = map(int,input().split())
ans = [0]*N
dict1 = {}
if  n > 1:
    ans[0] = 1
for x in range(M):
    a,b = map(int,input().split())
    if((a in dict1) != True):
        dict1[a] = b
    elif(a in dict1 and dict1[a] != b):
        print(-1)
        sys.exit()
for k, v in dict1.items():
    ans[k-1] = v
    if(k == 1 and v == 0 and N >= 2):
        print(-1)
        sys.exit()
#print(ans)
l = "".join([str(n) for n in ans])
int_l = int(l)
print(int_l)
#len_l = len(str(int_l))
#print(int_l)

Fixed submission:
import sys
N,M = map(int,input().split())
ans = [0]*N
dict1 = {}
if  N > 1:
    ans[0] = 1
for x in range(M):
    a,b = map(int,input().split())
    if((a in dict1) != True):
        dict1[a] = b
    elif(a in dict1 and dict1[a] != b):
        print(-1)
        sys.exit()
for k, v in dict1.items():
    ans[k-1] = v
    if(k == 1 and v == 0 and N >= 2):
        print(-1)
        sys.exit()
#print(ans)
l = "".join([str(n) for n in ans])
int_l = int(l)
print(int_l)
#len_l = len(str(int_l))
#print(int_l)

Buggy python submission (verdict: Runtime Error):
import sys
N,M = map(int,input().split())
ans = [0]*N
dict1 = {}
for x in range(M):
    a,b = map(int,input().split())
    if((a in dict1) != True):
        dict1[a] = b
    elif(a in dict1 and dict1[a] != b)):
        print(-1)
        sys.exit()
for k, v in dict1.items():
    ans[k-1] = v
    if(k == 1 and v == 0 and N == 3):
        print(-1)
        sys.exit()
    elif(k == 1 and v == 0 and N ==2):
        print(-1)
        sys.exit()
#print(ans)
l = "".join([str(n) for n in ans])
int_l = int(l)
print(int_l)
#len_l = len(str(int_l))
#print(int_l)

Fixed submission:
import sys
N,M = map(int,input().split())
ans = [0]*N
dict1 = {}
if  N > 1:
    ans[0] = 1
for x in range(M):
    a,b = map(int,input().split())
    if((a in dict1) != True):
        dict1[a] = b
    elif(a in dict1 and dict1[a] != b):
        print(-1)
        sys.exit()
for k, v in dict1.items():
    ans[k-1] = v
    if(k == 1 and v == 0 and N >= 2):
        print(-1)
        sys.exit()
#print(ans)
l = "".join([str(n) for n in ans])
int_l = int(l)
print(int_l)
#len_l = len(str(int_l))
#print(int_l)

Buggy python submission (verdict: Runtime Error):
import sys
N,M = map(int,input().split())
ans = [0]*N
dict1 = {}
for x in range(M):
    a,b = map(int,input().split())
    if((a in dict1) != True):
        dict1[a] = b
    elif(a in dict1 and dict1[a] != b)):
        print(-1)
        sys.exit()
for k, v in dict1.items():
    ans[k-1] = v
    if(k == 1 and v == 0 and N == 3):
        print(-1)
        sys.exit()
    elif(k == 1 and v == 0 and N ==2):
        print(-1)
        sys.exit()
#print(ans)
l = "".join([str(n) for n in ans])
int_l = int(l)
print(int_l)
#len_l = len(str(int_l))
#print(int_l)

Fixed submission:
import sys
N,M = map(int,input().split())
ans = [0]*N
dict1 = {}
if  N > 1:
    ans[0] = 1
for x in range(M):
    a,b = map(int,input().split())
    if((a in dict1) != True):
        dict1[a] = b
    elif(a in dict1 and dict1[a] != b):
        print(-1)
        sys.exit()
for k, v in dict1.items():
    ans[k-1] = v
    if(k == 1 and v == 0 and N >= 2):
        print(-1)
        sys.exit()
#print(ans)
l = "".join([str(n) for n in ans])
int_l = int(l)
print(int_l)
#len_l = len(str(int_l))
#print(int_l)