Buggy python submission (verdict: Time Limit Exceeded):
n, m = map(int, input().split())
ab = [[0, 0]] * m
for i in range(m):
    a, b = map(int, input().split())
    if a == 1 or b == n:
        ab[i] = [a, b]
contain_one = [j for i, j in ab if i == 1]
string_ab = [str(k)+str(l) for k, l in ab]

for b in contain_one:
    if str(b)+str(n) in set(string_ab):
        print("POSSIBLE")
        exit()
else:
    print("IMPOSSIBLE")


Fixed submission:
n, m = map(int, input().split())
ab = []
for i in range(m):
    a, b = map(int, input().split())
    if a == 1:
        ab.append(b)
    if b == n:
        ab.append(a)

if len(ab) != len(set(ab)):
        print("POSSIBLE")
        exit()
else:
    print("IMPOSSIBLE")

Buggy python submission (verdict: Time Limit Exceeded):
n, m = map(int, input().split())
ab = []
for i in range(m):
    a, b = map(int, input().split())
    if a == 1 or b == n:
        ab.append([a, b])
contain_one = [j for i, j in ab if i == 1]
string_ab = [str(k)+str(l) for k, l in ab]

for b in contain_one:
    if str(b)+str(n) in set(string_ab):
        print("POSSIBLE")
        exit()
else:
    print("IMPOSSIBLE")


Fixed submission:
n, m = map(int, input().split())
ab = []
for i in range(m):
    a, b = map(int, input().split())
    if a == 1:
        ab.append(b)
    if b == n:
        ab.append(a)

if len(ab) != len(set(ab)):
        print("POSSIBLE")
        exit()
else:
    print("IMPOSSIBLE")

Buggy python submission (verdict: Time Limit Exceeded):
n, m = map(int, input().split())
ab = [list(map(int, input().split())) for i in range(m)]
contain_one = [j for i, j in ab if i == 1]
string_ab = [str(k)+str(l) for k, l in ab]

for b in contain_one:
    if str(b)+str(n) in set(string_ab):
        print("POSSIBLE")
        exit()
else:
    print("IMPOSSIBLE")


Fixed submission:
n, m = map(int, input().split())
ab = []
for i in range(m):
    a, b = map(int, input().split())
    if a == 1:
        ab.append(b)
    if b == n:
        ab.append(a)

if len(ab) != len(set(ab)):
        print("POSSIBLE")
        exit()
else:
    print("IMPOSSIBLE")

Buggy python submission (verdict: Time Limit Exceeded):
n, m = map(int, input().split())
ab = [list(map(int, input().split())) for i in range(m)]
contain_one = [[i, j] for i, j in ab if i == 1]
string_ab = [str(k)+str(l) for k, l in ab]

for a, b in contain_one:
    if str(b)+str(n) in set(string_ab):
        print("POSSIBLE")
        exit()
else:
    print("IMPOSSIBLE")


Fixed submission:
n, m = map(int, input().split())
ab = []
for i in range(m):
    a, b = map(int, input().split())
    if a == 1:
        ab.append(b)
    if b == n:
        ab.append(a)

if len(ab) != len(set(ab)):
        print("POSSIBLE")
        exit()
else:
    print("IMPOSSIBLE")

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

for a, b in contain_one:
    if [b, n] in ab:
        print("POSSIBLE")
        exit()
else:
    print("IMPOSSIBLE")


Fixed submission:
n, m = map(int, input().split())
ab = []
for i in range(m):
    a, b = map(int, input().split())
    if a == 1:
        ab.append(b)
    if b == n:
        ab.append(a)

if len(ab) != len(set(ab)):
        print("POSSIBLE")
        exit()
else:
    print("IMPOSSIBLE")

Buggy python submission (verdict: Time Limit Exceeded):
n, m = map(int, input().split())
ab = [list(map(int, input().split())) for i in range(m)]
contain_one = [[i, j] for i, j in ab if i == 1]
contain_n = [[k, l] for k, l in ab if l == n]

for a, b in contain_one:
    second = b
    for c, d in contain_n:
        if c == second:
            print("POSSIBLE")
            exit()
else:
    print("IMPOSSIBLE")




Fixed submission:
n, m = map(int, input().split())
ab = []
for i in range(m):
    a, b = map(int, input().split())
    if a == 1:
        ab.append(b)
    if b == n:
        ab.append(a)

if len(ab) != len(set(ab)):
        print("POSSIBLE")
        exit()
else:
    print("IMPOSSIBLE")

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

for a, b in contain_one:
    second = b
    for c, d in ab:
        if c == second:
            if d == n:
                print("POSSIBLE")
                exit()
else:
    print("IMPOSSIBLE")


Fixed submission:
n, m = map(int, input().split())
ab = []
for i in range(m):
    a, b = map(int, input().split())
    if a == 1:
        ab.append(b)
    if b == n:
        ab.append(a)

if len(ab) != len(set(ab)):
        print("POSSIBLE")
        exit()
else:
    print("IMPOSSIBLE")