Buggy python submission (verdict: Runtime Error):
n, m = map(int, input().split())
a = [0] * m
b = [0] * m
first = {}
second = {}
for i in range(m):
    a[i], b[i] = map(int, input().split())
    if a[i] == 1:
        first.add(b[i])
    if b[i] == n:
        second.add(a[i])


ans = 'IMPOSSIBLE'
if first & second:
    ans = 'POSSIBLE'
print(ans)


Fixed submission:
n, m = map(int, input().split())
a = [0] * m
b = [0] * m
first = set()
second = set()
for i in range(m):
    a[i], b[i] = map(int, input().split())
    if a[i] == 1:
        first.add(b[i])
    if b[i] == n:
        second.add(a[i])


ans = 'IMPOSSIBLE'
if first & second:
    ans = 'POSSIBLE'
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
n, m = map(int, input().split())
a = [0] * m
b = [0] * m
for i in range(m):
    a[i], b[i] = map(int, input().split())

first = []
second = []
for i in range(m):
    if a[i] == 1:
        first.append(b[i])

    if b[i] == n:
        second.append(a[i])
ans = 'IMPOSSIBLE'
for i in first:
    if i in second:
        ans = 'POSSIBLE'
print(ans)

Fixed submission:
n, m = map(int, input().split())
a = [0] * m
b = [0] * m
first = set()
second = set()
for i in range(m):
    a[i], b[i] = map(int, input().split())
    if a[i] == 1:
        first.add(b[i])
    if b[i] == n:
        second.add(a[i])


ans = 'IMPOSSIBLE'
if first & second:
    ans = 'POSSIBLE'
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
n, m = map(int, input().split())
a = [0] * m
b = [0] * m
for i in range(m):
    a[i], b[i] = map(int, input().split())

first = []
second = []
for i in range(m):
    if a[i] == 1:
        first.append(b[i])

    if b[i] == n:
        second.append(a[i])
ans = 'IMPOSSIBLE'
for i in first:
    if i in second:
        ans = 'POSSIBLE'
print(ans)

Fixed submission:
n, m = map(int, input().split())
a = [0] * m
b = [0] * m
first = set()
second = set()
for i in range(m):
    a[i], b[i] = map(int, input().split())
    if a[i] == 1:
        first.add(b[i])
    if b[i] == n:
        second.add(a[i])


ans = 'IMPOSSIBLE'
if first & second:
    ans = 'POSSIBLE'
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
n, m = map(int, input().split())
a = [0] * m
b = [0] * m
for i in range(m):
    a[i], b[i] = map(int, input().split())

first = []
for i in range(m):
    if a[i] == 1:
        first.append(b[i])
second = []
ans = 'IMPOSSIBLE'
for i in range(m):
    if a[i] in first:
        second.append(b[i])

for i in second:
    if i == n:
        ans = 'POSSIBLE'
print(ans)

Fixed submission:
n, m = map(int, input().split())
a = [0] * m
b = [0] * m
first = set()
second = set()
for i in range(m):
    a[i], b[i] = map(int, input().split())
    if a[i] == 1:
        first.add(b[i])
    if b[i] == n:
        second.add(a[i])


ans = 'IMPOSSIBLE'
if first & second:
    ans = 'POSSIBLE'
print(ans)

Buggy python submission (verdict: Time Limit Exceeded):
n, m = map(int, input().split())
a = [0] * m
b = [0] * m
for i in range(m):
    a[i], b[i] = map(int, input().split())

first = []
for i in range(m):
    if a[i] == 1:
        first.append(b[i])
second = []
ans = 'IMPOSSIBLE'
for i in range(m):
    if a[i] in first:
        second.append(b[i])

for i in second:
    if i == n:
        ans = 'POSSIBLE'
print(ans)

Fixed submission:
n, m = map(int, input().split())
a = [0] * m
b = [0] * m
first = set()
second = set()
for i in range(m):
    a[i], b[i] = map(int, input().split())
    if a[i] == 1:
        first.add(b[i])
    if b[i] == n:
        second.add(a[i])


ans = 'IMPOSSIBLE'
if first & second:
    ans = 'POSSIBLE'
print(ans)