Buggy python submission (verdict: Time Limit Exceeded):
arr = input().split()
n = int(arr[0])
m = int(arr[1])

a = [0] * m
b = [0] * m

mat = [[0] * n for i in range(n)]
path = []
for i in range(m):
    tmp = input().split()
    a[i] = int(tmp[0])
    b[i] = int(tmp[1])
    mat[a[i]-1][b[i]-1] = 1
    if a[i] == 1:
        path.append(b[i]-1)

flag = False
for i in range(len(path)):
        if mat[path[i]][n-1] == 1: 
            flag = True
            break

if flag == True:
    print('POSSIBLE')
else:
    print('IMPOSSIBLE')
    

Fixed submission:
arr = input().split()
n = int(arr[0])
m = int(arr[1])

x = []
y = []

for i in range(m):
    a,b = map(int, input().split())
    if a == 1:
        x.append(b)
    if b == n:
        y.append(a)

if len(set(x+y)) < len(x) + len(y):
    print('POSSIBLE')
else:
    print('IMPOSSIBLE')

Buggy python submission (verdict: Time Limit Exceeded):
arr = input().split()
n = int(arr[0])
m = int(arr[1])

a = [0] * m
b = [0] * m

mat = [[0] * n for i in range(n)]

for i in range(m):
    tmp = input().split()
    a[i] = int(tmp[0])
    b[i] = int(tmp[1])
    mat[a[i]-1][b[i]-1] = 1
    #mat[b[i]-1][a[i]-1] = 1

path = []
for i in range(n):
    if mat[0][i] == 1:
        path.append(i)

flag = False
for i in range(len(path)):
        if mat[path[i]][n-1] == 1: 
            flag = True
            break

if flag == True:
    print('POSSIBLE')
else:
    print('IMPOSSIBLE')
    

Fixed submission:
arr = input().split()
n = int(arr[0])
m = int(arr[1])

x = []
y = []

for i in range(m):
    a,b = map(int, input().split())
    if a == 1:
        x.append(b)
    if b == n:
        y.append(a)

if len(set(x+y)) < len(x) + len(y):
    print('POSSIBLE')
else:
    print('IMPOSSIBLE')

Buggy python submission (verdict: Time Limit Exceeded):
arr = input().split()
n = int(arr[0])
m = int(arr[1])

a = [0] * m
b = [0] * m

for i in range(m):
    tmp = input().split()
    a[i] = int(tmp[0])
    b[i] = int(tmp[1])

mat = [[0] * n for i in range(n)]

for i in range(m):
    mat[a[i]-1][b[i]-1] = 1
    #mat[b[i]-1][a[i]-1] = 1

path = []
for i in range(n):
    if mat[0][i] == 1:
        path.append(i)

flag = False
for i in range(len(path)):
        if mat[path[i]][n-1] == 1: 
            flag = True
            break

if flag == True:
    print('POSSIBLE')
else:
    print('IMPOSSIBLE')
    


Fixed submission:
arr = input().split()
n = int(arr[0])
m = int(arr[1])

x = []
y = []

for i in range(m):
    a,b = map(int, input().split())
    if a == 1:
        x.append(b)
    if b == n:
        y.append(a)

if len(set(x+y)) < len(x) + len(y):
    print('POSSIBLE')
else:
    print('IMPOSSIBLE')

Buggy python submission (verdict: Time Limit Exceeded):
arr = input().split()
n = int(arr[0])
m = int(arr[1])

a = [0] * m
b = [0] * m

for i in range(m):
    tmp = input().split()
    a[i] = int(tmp[0])
    b[i] = int(tmp[1])

mat = [[0] * n for i in range(n)]

for i in range(m):
    mat[a[i]-1][b[i]-1] = 1
    mat[b[i]-1][a[i]-1] = 1

path = []
for i in range(n):
    if mat[0][i] == 1:
        path.append(i)

flag = False
for i in range(len(path)):
        if mat[path[i]][n-1] == 1: 
            flag = True
            break

if flag == True:
    print('POSSIBLE')
else:
    print('IMPOSSIBLE')
    


Fixed submission:
arr = input().split()
n = int(arr[0])
m = int(arr[1])

x = []
y = []

for i in range(m):
    a,b = map(int, input().split())
    if a == 1:
        x.append(b)
    if b == n:
        y.append(a)

if len(set(x+y)) < len(x) + len(y):
    print('POSSIBLE')
else:
    print('IMPOSSIBLE')

Buggy python submission (verdict: Time Limit Exceeded):
arr = input().split()
n = int(arr[0])
m = int(arr[1])

a = [0] * m
b = [0] * m

for i in range(m):
    tmp = input().split()
    a[i] = int(tmp[0])
    b[i] = int(tmp[1])

mat = [[0] * n for i in range(n)]

for i in range(m):
    mat[a[i]-1][b[i]-1] = 1
    mat[b[i]-1][a[i]-1] = 1

path = []
for i in range(n):
    if mat[0][i] == 1:
        path.append(i)

flag = False
for i in range(len(path)):
        if mat[path[i]][n-1] == 1: 
            flag = True

if flag == True:
    print('POSSIBLE')
else:
    print('IMPOSSIBLE')
    


Fixed submission:
arr = input().split()
n = int(arr[0])
m = int(arr[1])

x = []
y = []

for i in range(m):
    a,b = map(int, input().split())
    if a == 1:
        x.append(b)
    if b == n:
        y.append(a)

if len(set(x+y)) < len(x) + len(y):
    print('POSSIBLE')
else:
    print('IMPOSSIBLE')