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())
c = []
d = []
for i in range(m):
    
    if a[i] == 1:
        c.append(b[i])
    if b[i] == n:
        d.append(a[i])
ans = False
for i in c:
    if d.count(i) >=1:
        ans = True
        break
if ans:
    print('POSSIBLE')
else:
    print('IMPOSSIBLE')

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

for i in range(m):
    a[i],b[i] = map(int,input().split())

go = []
goal = []

for i in range(len(a)):
    if a[i] == 1:
        go.append(b[i])
    if b[i] == n:
        goal.append(a[i])

count = [0 for i in range(n)]
for i in range(len(go)):
    count[go[i]-1] = 1
for i in range(len(goal)):
    count[goal[i]-1] += 1
for i in range(len(count)):
    if count[i] > 1:
        print("POSSIBLE")
        exit()
print("IMPOSSIBLE")

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())
c = []
d = []
for i in range(m):
    
    if a[i] == 1:
        c.append(b[i])
    if b[i] == n:
        d.append(a[i])
ans = False
c = list(set(c))
for i in c:
    if d.count(i) >=1:
        ans = True
        break
if ans:
    print('POSSIBLE')
else:
    print('IMPOSSIBLE')

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

for i in range(m):
    a[i],b[i] = map(int,input().split())

go = []
goal = []

for i in range(len(a)):
    if a[i] == 1:
        go.append(b[i])
    if b[i] == n:
        goal.append(a[i])

count = [0 for i in range(n)]
for i in range(len(go)):
    count[go[i]-1] = 1
for i in range(len(goal)):
    count[goal[i]-1] += 1
for i in range(len(count)):
    if count[i] > 1:
        print("POSSIBLE")
        exit()
print("IMPOSSIBLE")

Buggy python submission (verdict: Runtime Error):
n,m = map(int, input().split())
a,b = [0]*m
for i in range(m):
    a[i],b[i] = map(int,input().split())
c = []
d = []
for i in range(m):
    
    if a[i] == 1:
        c.append(b[i])
    if b[i][1] == n:
        d.append(a[i])
ans = False
c = list(set(c))
for i in c:
    if d.count(i) >=1:
        ans = True
        break
if ans:
    print('POSSIBLE')
else:
    print('IMPOSSIBLE')

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

for i in range(m):
    a[i],b[i] = map(int,input().split())

go = []
goal = []

for i in range(len(a)):
    if a[i] == 1:
        go.append(b[i])
    if b[i] == n:
        goal.append(a[i])

count = [0 for i in range(n)]
for i in range(len(go)):
    count[go[i]-1] = 1
for i in range(len(goal)):
    count[goal[i]-1] += 1
for i in range(len(count)):
    if count[i] > 1:
        print("POSSIBLE")
        exit()
print("IMPOSSIBLE")

Buggy python submission (verdict: Time Limit Exceeded):
n,m = map(int, input().split())

a = [input().split() for i in range(m)]
c = []
d = []
for i in range(m):
    
    if int(a[i][0]) == 1:
        c.append(int(a[i][1]))
    elif int(a[i][1]) == n:
        d.append(int(a[i][0]))
ans = False
c = list(set(c))
for i in c:
    if d.count(i) >=1:
        ans = True
        break
if ans:
    print('POSSIBLE')
else:
    print('IMPOSSIBLE')

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

for i in range(m):
    a[i],b[i] = map(int,input().split())

go = []
goal = []

for i in range(len(a)):
    if a[i] == 1:
        go.append(b[i])
    if b[i] == n:
        goal.append(a[i])

count = [0 for i in range(n)]
for i in range(len(go)):
    count[go[i]-1] = 1
for i in range(len(goal)):
    count[goal[i]-1] += 1
for i in range(len(count)):
    if count[i] > 1:
        print("POSSIBLE")
        exit()
print("IMPOSSIBLE")

Buggy python submission (verdict: Time Limit Exceeded):
n,m = map(int, input().split())

a = [input().split() for i in range(m)]
c = []
d = []
for i in range(m):
    if int(a[i][0]) == 1 and int(a[i][1]) == n:
        continue
    elif int(a[i][0]) == 1:
        c.append(int(a[i][1]))
    elif int(a[i][1]) == n:
        d.append(int(a[i][0]))
ans = False
c = list(set(c))
for i in c:
    if d.count(i) >=1:
        ans = True
        break
if ans:
    print('POSSIBLE')
else:
    print('IMPOSSIBLE')

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

for i in range(m):
    a[i],b[i] = map(int,input().split())

go = []
goal = []

for i in range(len(a)):
    if a[i] == 1:
        go.append(b[i])
    if b[i] == n:
        goal.append(a[i])

count = [0 for i in range(n)]
for i in range(len(go)):
    count[go[i]-1] = 1
for i in range(len(goal)):
    count[goal[i]-1] += 1
for i in range(len(count)):
    if count[i] > 1:
        print("POSSIBLE")
        exit()
print("IMPOSSIBLE")

Buggy python submission (verdict: Time Limit Exceeded):
n,m = map(int, input().split())

a = [input().split() for i in range(m)]
c = []
d = []
for i in range(m):
    if int(a[i][0]) == 1 and int(a[i][1]) == n:
        continue
    elif int(a[i][0]) == 1:
        c.append(a[i][1])
    elif int(a[i][1]) == n:
        d.append(a[i][0])
ans = False
for i in range(len(c)):
    for j in range(len(d)):
        if c[i] == d[j]:
            ans = True
            break
if ans:
    print('POSSIBLE')
else:
    print('IMPOSSIBLE')

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

for i in range(m):
    a[i],b[i] = map(int,input().split())

go = []
goal = []

for i in range(len(a)):
    if a[i] == 1:
        go.append(b[i])
    if b[i] == n:
        goal.append(a[i])

count = [0 for i in range(n)]
for i in range(len(go)):
    count[go[i]-1] = 1
for i in range(len(goal)):
    count[goal[i]-1] += 1
for i in range(len(count)):
    if count[i] > 1:
        print("POSSIBLE")
        exit()
print("IMPOSSIBLE")