Buggy python submission (verdict: Time Limit Exceeded):
N,M = map(int,input().split())
a_list=[]
pass_1= []
for i in range(M):
    a = list(map(int,input().split()))
    if(a[0]==1):
        pass_1.append(a[1])
    if(a[1]==N):
        a_list.append(a)
    
for j in pass_1:
    if([j,N] in a_list):
        print("POSSIBLE")
        exit()
print("IMPOSSIBLE")

Fixed submission:
N,M = map(int,input().split())
a_list=[]
pass_1= []
for i in range(M):
    a = list(map(int,input().split()))
    if(a[0]==1):
        pass_1.append(a[1])
    elif(a[1]==N):
        a_list.append(a[0])
    
if list(set(pass_1) & set(a_list)):
    print('POSSIBLE')
else:
    print('IMPOSSIBLE')

Buggy python submission (verdict: Time Limit Exceeded):
N,M = map(int,input().split())
a_list=[]
pass_1= []
for i in range(M):
    a = list(map(int,input().split()))
    if(a[0]==1):
        pass_1.append(a[1])
    else:
        a_list.append(a)
    
for j in pass_1:
    if([j,N] in a_list):
        print("POSSIBLE")
        exit()
print("IMPOSSIBLE")

Fixed submission:
N,M = map(int,input().split())
a_list=[]
pass_1= []
for i in range(M):
    a = list(map(int,input().split()))
    if(a[0]==1):
        pass_1.append(a[1])
    elif(a[1]==N):
        a_list.append(a[0])
    
if list(set(pass_1) & set(a_list)):
    print('POSSIBLE')
else:
    print('IMPOSSIBLE')

Buggy python submission (verdict: Time Limit Exceeded):
N,M = map(int,input().split())
a_list=[]
pass_1= []
for i in range(M):
    a = list(map(int,input().split()))
    if(a[0]==1):
        pass_1.append(a[1])
    else:
        a_list.append(a)
    
for j in pass_1:
    if([j,N] in a_list):
        print("POSSIBLE")
        exit()
print("IMPOSSIBLE")

Fixed submission:
N,M = map(int,input().split())
a_list=[]
pass_1= []
for i in range(M):
    a = list(map(int,input().split()))
    if(a[0]==1):
        pass_1.append(a[1])
    elif(a[1]==N):
        a_list.append(a[0])
    
if list(set(pass_1) & set(a_list)):
    print('POSSIBLE')
else:
    print('IMPOSSIBLE')

Buggy python submission (verdict: Runtime Error):
N,M = map(int,input().split())
a_list=[]
pass_1= []
for i in range(M):
    a = list(map(int,input().split())
    if(a[0]==1):
        pass_1.append(a[1])
    else:
        a_list.append(a)
    
for j in pass_1:
    if([j,N] in a):
        print("POSSIBLE")
        exit()
print("IMPOSSIBLE")

Fixed submission:
N,M = map(int,input().split())
a_list=[]
pass_1= []
for i in range(M):
    a = list(map(int,input().split()))
    if(a[0]==1):
        pass_1.append(a[1])
    elif(a[1]==N):
        a_list.append(a[0])
    
if list(set(pass_1) & set(a_list)):
    print('POSSIBLE')
else:
    print('IMPOSSIBLE')

Buggy python submission (verdict: Time Limit Exceeded):
N,M = map(int,input().split())
a=[]
pass_1= []
for i in range(M):
    a.append(list(map(int,input().split())))
for i in range(M):
    if(a[i][0]==1):
        pass_1.append(a[i][1])
for j in pass_1:
    if([j,N] in a):
        print("POSSIBLE")
        exit()
print("IMPOSSIBLE")

Fixed submission:
N,M = map(int,input().split())
a_list=[]
pass_1= []
for i in range(M):
    a = list(map(int,input().split()))
    if(a[0]==1):
        pass_1.append(a[1])
    elif(a[1]==N):
        a_list.append(a[0])
    
if list(set(pass_1) & set(a_list)):
    print('POSSIBLE')
else:
    print('IMPOSSIBLE')