Buggy python submission (verdict: Time Limit Exceeded):
n, m = list(map(int, input().split()))
# a = list(map(int, input().split()))
# abc = [int(input()) for i in range(5)]
ab = []
l = []
for i in range(m):
    a, b = map(int, input().split())
    ab.append([a, b])
    if a == 1:
        l.append(b)

for i in range(m):
    if ab[i][1] == n and ab[i][0] in l:
        print("POSSIBLE")
        exit()
print("IMPOSSIBLE")


Fixed submission:
n, m = list(map(int, input().split()))
# a = list(map(int, input().split()))
# abc = [int(input()) for i in range(5)]
to = [[] for i in range(n)]
for i in range(m):
    a, b = map(int, input().split())
    to[a-1].append(b-1)
    to[b-1].append(a-1)
# print(to)
for i in range(len(to[0])):
    if n-1 in to[to[0][i]]:
        print("POSSIBLE")
        exit()
print("IMPOSSIBLE")

Buggy python submission (verdict: Time Limit Exceeded):
n, m = list(map(int, input().split()))
#ab = []
aida = []
#start = []
for i in range(m):
    x, y = [int(j) for j in input().split()]
    if y == n:
        if x in aida:
            print("POSSIBLE")
            exit()
        else:
            aida.append(x)
    if x == 1:
        if y in aida:
            print("POSSIBLE")
            exit()
        else:
            aida.append(y)
    #ab.append((x, y))

"""
for i in range(len(start)):
    if start[i] in aida:
        print("POSSIBLE")
        exit()
"""
print("IMPOSSIBLE")


Fixed submission:
n, m = list(map(int, input().split()))
# a = list(map(int, input().split()))
# abc = [int(input()) for i in range(5)]
to = [[] for i in range(n)]
for i in range(m):
    a, b = map(int, input().split())
    to[a-1].append(b-1)
    to[b-1].append(a-1)
# print(to)
for i in range(len(to[0])):
    if n-1 in to[to[0][i]]:
        print("POSSIBLE")
        exit()
print("IMPOSSIBLE")

Buggy python submission (verdict: Time Limit Exceeded):
n, m = list(map(int, input().split()))
#ab = []
aida = []
#start = []
for i in range(m):
    x, y = [int(j) for j in input().split()]
    if y == n:
        if x in aida:
            print("POSSIBLE")
            exit()
        else:
            aida.append(x)
    if x == 1:
        if y in aida:
            print("POSSIBLE")
            exit()
        else:
            aida.append(y)
    #ab.append((x, y))

print("IMPOSSIBLE")


Fixed submission:
n, m = list(map(int, input().split()))
# a = list(map(int, input().split()))
# abc = [int(input()) for i in range(5)]
to = [[] for i in range(n)]
for i in range(m):
    a, b = map(int, input().split())
    to[a-1].append(b-1)
    to[b-1].append(a-1)
# print(to)
for i in range(len(to[0])):
    if n-1 in to[to[0][i]]:
        print("POSSIBLE")
        exit()
print("IMPOSSIBLE")

Buggy python submission (verdict: Time Limit Exceeded):
n, m = list(map(int, input().split()))
#ab = []
aida = []
start = []
for i in range(m):
    x, y = [int(j) for j in input().split()]
    if y == n:
        aida.append(x)
    if x == 1:
        start.append(y)
    #ab.append((x, y))

for i in range(len(start)):
    if start[i] in aida:
        print("POSSIBLE")
        exit()

print("IMPOSSIBLE")


Fixed submission:
n, m = list(map(int, input().split()))
# a = list(map(int, input().split()))
# abc = [int(input()) for i in range(5)]
to = [[] for i in range(n)]
for i in range(m):
    a, b = map(int, input().split())
    to[a-1].append(b-1)
    to[b-1].append(a-1)
# print(to)
for i in range(len(to[0])):
    if n-1 in to[to[0][i]]:
        print("POSSIBLE")
        exit()
print("IMPOSSIBLE")

Buggy python submission (verdict: Time Limit Exceeded):
n, m = list(map(int, input().split()))
ab = []
aida = []
for i in range(m):
    x, y = [int(j) for j in input().split()]
    if y == n:
        aida.append(x)
    ab.append((x, y))

for i in range(m):
    if ab[i][0] == 1 and ab[i][1] in aida:
        print("POSSIBLE")
        exit()

print("IMPOSSIBLE")

Fixed submission:
n, m = list(map(int, input().split()))
# a = list(map(int, input().split()))
# abc = [int(input()) for i in range(5)]
to = [[] for i in range(n)]
for i in range(m):
    a, b = map(int, input().split())
    to[a-1].append(b-1)
    to[b-1].append(a-1)
# print(to)
for i in range(len(to[0])):
    if n-1 in to[to[0][i]]:
        print("POSSIBLE")
        exit()
print("IMPOSSIBLE")

Buggy python submission (verdict: Time Limit Exceeded):
n, m = list(map(int, input().split()))
ab = []
for i in range(m):
    x, y = [int(j) for j in input().split()]
    ab.append((x, y))

aida = []
for i in range(m):
    if ab[i][1] == n:
        aida.append(ab[i][0])

for i in range(m):
    if ab[i][0] == 1 and ab[i][1] in aida:
        print("POSSIBLE")
        exit()

print("IMPOSSIBLE")


Fixed submission:
n, m = list(map(int, input().split()))
# a = list(map(int, input().split()))
# abc = [int(input()) for i in range(5)]
to = [[] for i in range(n)]
for i in range(m):
    a, b = map(int, input().split())
    to[a-1].append(b-1)
    to[b-1].append(a-1)
# print(to)
for i in range(len(to[0])):
    if n-1 in to[to[0][i]]:
        print("POSSIBLE")
        exit()
print("IMPOSSIBLE")

Buggy python submission (verdict: Time Limit Exceeded):
n, m = list(map(int, input().split()))
ab = []
for i in range(m):
    x, y = [int(j) for j in input().split()]
    ab.append((x, y))

aida = []
for i in range(m):
    if ab[i][1] == n:
        aida.append(ab[i][0])

for i in range(m):
    if ab[i][0] == 1 and ab[i][1] in aida:
        print("POSSIBLE")
        exit()

print("IMPOSSIBLE")


Fixed submission:
n, m = list(map(int, input().split()))
# a = list(map(int, input().split()))
# abc = [int(input()) for i in range(5)]
to = [[] for i in range(n)]
for i in range(m):
    a, b = map(int, input().split())
    to[a-1].append(b-1)
    to[b-1].append(a-1)
# print(to)
for i in range(len(to[0])):
    if n-1 in to[to[0][i]]:
        print("POSSIBLE")
        exit()
print("IMPOSSIBLE")