Buggy python submission (verdict: Runtime Error):
n, m = map(int,input().split())

l = [[0 for _ in range(2)] for _ in range(m)]

f = 0
con = ""

for i in range(n):
    s, c = map(int,input().split())
    if l[s-1][1] == 0 or l[s-1][0] == c:
        if s == 1 and c == 0:
            f = 1
            break
        l[s-1][0] = c
        l[s-1][1] = 1
    else:
        f = 1
        break
else:
    for j in range(m):
        if l[j][0] != 0:
            break
        else:
            f = 1
            break

if f:
    print(-1)
else:
    for i in range(m):
        con += str(l[i][0])
    print(int(con))

Fixed submission:
# n = int(input())
n, m = map(int,input().split())
# l = [[0 for _ in range(n)] for _ in range(n)]
l = []
f = 0

for i in range(m):
    l.append(list(map(int,input().split())))

# print(l)

for i in range(1000):
    si = str(i)
    if len(si) == n:
        for j in range(m):
            # print(si, l)
            if si[l[j][0]-1] == str(l[j][1]):
                # print('OK')
                f = 0
            else:
                f = 1
                break
    else:
        continue
    if f == 0:
        print(si)
        exit()

print(-1)

Buggy python submission (verdict: Runtime Error):
n, m = map(int,input().split())

l = [[0 for _ in range(2)] for _ in range(m)]

f = 0
con = ""

for i in range(n):
    s, c = map(int,input().split()))
    if l[s-1][1] == 0 or l[s-1][0] == c:
        if s == 1 and c == 0:
            f = 1
            break
        l[s-1][0] = c
        l[s-1][1] = 1
    else:
        f = 1
        break
else:
    for j in range(m):
        if l[j][0] != 0:
            break
        else:
            f = 1
            break

if f:
    print(-1)
else:
    for i in range(m):
        con += str(l[i][0])
    print(int(con))
    


Fixed submission:
# n = int(input())
n, m = map(int,input().split())
# l = [[0 for _ in range(n)] for _ in range(n)]
l = []
f = 0

for i in range(m):
    l.append(list(map(int,input().split())))

# print(l)

for i in range(1000):
    si = str(i)
    if len(si) == n:
        for j in range(m):
            # print(si, l)
            if si[l[j][0]-1] == str(l[j][1]):
                # print('OK')
                f = 0
            else:
                f = 1
                break
    else:
        continue
    if f == 0:
        print(si)
        exit()

print(-1)

Buggy python submission (verdict: Runtime Error):
n, m = map(int,input().split())

l = [[0 for _ in range(2)] for _ in range(m)]

f = 0
con = ""

for i in range(n):
    s, c = (list(map(int,input().split())))
    if l[s-1][1] == 0 or l[s-1][0] == c:
        if s == 1 and c == 0:
            f = 1
            break
        l[s-1][0] = c
        l[s-1][1] = 1
    else:
        f = 1
        break
else:
    for j in range(m):
        if l[j][0] != 0:
            break
        else:
            f = 1
            break

if f:
    print(-1)
else:
    for i in range(m):
        con += str(l[i][0])
    print(int(con))

Fixed submission:
# n = int(input())
n, m = map(int,input().split())
# l = [[0 for _ in range(n)] for _ in range(n)]
l = []
f = 0

for i in range(m):
    l.append(list(map(int,input().split())))

# print(l)

for i in range(1000):
    si = str(i)
    if len(si) == n:
        for j in range(m):
            # print(si, l)
            if si[l[j][0]-1] == str(l[j][1]):
                # print('OK')
                f = 0
            else:
                f = 1
                break
    else:
        continue
    if f == 0:
        print(si)
        exit()

print(-1)

Buggy python submission (verdict: Runtime Error):
n, m = map(int,input().split())

l = [[0 for _ in range(2)] for _ in range(n)]

f = 0
con = ""

for i in range(n):
    s, c = (list(map(int,input().split())))
    if l[s-1][1] == 0 or l[s-1][0] == c:
        if s == 1 and c == 0:
            f = 1
            break
        l[s-1][0] = c
        l[s-1][1] = 1
    else:
        f = 1
        break
else:
    for j in range(n):
        if l[j][0] != 0:
            break
        else:
            f = 1
            break

if f:
    print(-1)
else:
    for i in range(n):
        con += str(l[i][0])
    print(int(con))

Fixed submission:
# n = int(input())
n, m = map(int,input().split())
# l = [[0 for _ in range(n)] for _ in range(n)]
l = []
f = 0

for i in range(m):
    l.append(list(map(int,input().split())))

# print(l)

for i in range(1000):
    si = str(i)
    if len(si) == n:
        for j in range(m):
            # print(si, l)
            if si[l[j][0]-1] == str(l[j][1]):
                # print('OK')
                f = 0
            else:
                f = 1
                break
    else:
        continue
    if f == 0:
        print(si)
        exit()

print(-1)

Buggy python submission (verdict: Runtime Error):
n, m = map(int,input().split())

l = [[0 for _ in range(2)] for _ in range(n)]

print(l)
f = 0
con = ""

for i in range(n):
    s, c = (list(map(int,input().split())))
    if l[s-1][1] == 0 or l[s-1][0] == c:
        if s == 1 and c == 0:
            f = 1
            break
        l[s-1][0] = c
        l[s-1][1] = 1
    else:
        f = 1
        break
else:
    for j in range(n):
        if l[j][0] != 0:
            break
        else:
            f = 1
            break

if f:
    print(-1)
else:
    for i in range(n):
        con += str(l[i][0])
    print(int(con))

Fixed submission:
# n = int(input())
n, m = map(int,input().split())
# l = [[0 for _ in range(n)] for _ in range(n)]
l = []
f = 0

for i in range(m):
    l.append(list(map(int,input().split())))

# print(l)

for i in range(1000):
    si = str(i)
    if len(si) == n:
        for j in range(m):
            # print(si, l)
            if si[l[j][0]-1] == str(l[j][1]):
                # print('OK')
                f = 0
            else:
                f = 1
                break
    else:
        continue
    if f == 0:
        print(si)
        exit()

print(-1)

Buggy python submission (verdict: Runtime Error):
n, m = map(int,input().split())

l = [[0 for _ in range(2)] for _ in range(n)]

print(l)
f = 0
con = ""

for i in range(n):
    s, c = (list(map(int,input().split())))
    if l[s-1][1] == 0 or l[s-1][0] == c:
        if s == 1 and c == 0:
            f = 1
            break
        l[s-1][0] = c
        l[s-1][1] = 1
    else:
        f = 1
        break

if f:
    print(-1)
else:
    for i in range(n):
        con += str(l[i][0])
    print(con)

Fixed submission:
# n = int(input())
n, m = map(int,input().split())
# l = [[0 for _ in range(n)] for _ in range(n)]
l = []
f = 0

for i in range(m):
    l.append(list(map(int,input().split())))

# print(l)

for i in range(1000):
    si = str(i)
    if len(si) == n:
        for j in range(m):
            # print(si, l)
            if si[l[j][0]-1] == str(l[j][1]):
                # print('OK')
                f = 0
            else:
                f = 1
                break
    else:
        continue
    if f == 0:
        print(si)
        exit()

print(-1)