Buggy python submission (verdict: Time Limit Exceeded):
import sys 

N,M  = map(int,input().split())
     
a = [[0 for i in range(2)] for j in range(M)]
b = []     
for l in range(M):
  a[l][0] , a[l][1] = map(int,input().split())
  if a[l][0] == 1:
    b.append(l)

res = 'IMPOSSIBLE'

for i in b:
  for k in range(M):
    if a[k][0] == a[i][1] and a[k][1] == N:
         res = 'POSSIBLE'
         break

print (res)


Fixed submission:
import sys 

N,M  = map(int,input().split())
     
a = [[0 for i in range(2)] for j in range(M)]
b = [] 
c = []

for i in range(M):
  a[i][0] , a[i][1] = map(int,input().split())
  first, second = a[i][0],a[i][1]
  if first == 1:
    b.append(second)
  if second == N:
    c.append(first)

b_set = set(b)
c_set = set(c)

if list(b_set & c_set) is None or len(list(b_set & c_set)):
  res = ('POSSIBLE')
else:
  res = ('IMPOSSIBLE')

print(res)

Buggy python submission (verdict: Time Limit Exceeded):
import sys 

N,M  = map(int,input().split())
     
a = [[0 for i in range(2)] for j in range(M)]
b = []     
for l in range(M):
  a[l][0] , a[l][1] = map(int,input().split())
  if a[l][0] == 1:
    b.append(l)

res = 'IMPOSSIBLE'

for i in b:
  for k in range(M):
    if a[k][0] == a[i][1]:
      if a[k][1] == N:
         res = 'POSSIBLE'
         break

print (res)


Fixed submission:
import sys 

N,M  = map(int,input().split())
     
a = [[0 for i in range(2)] for j in range(M)]
b = [] 
c = []

for i in range(M):
  a[i][0] , a[i][1] = map(int,input().split())
  first, second = a[i][0],a[i][1]
  if first == 1:
    b.append(second)
  if second == N:
    c.append(first)

b_set = set(b)
c_set = set(c)

if list(b_set & c_set) is None or len(list(b_set & c_set)):
  res = ('POSSIBLE')
else:
  res = ('IMPOSSIBLE')

print(res)

Buggy python submission (verdict: Time Limit Exceeded):
N,M  = map(int,input().split())
     
a = [[0 for i in range(2)] for j in range(M)]
b = []     
for l in range(M):
  a[l][0] , a[l][1] = map(int,input().split())
  if a[l][0] == 1:
    b.append(l)

res = 'IMPOSSIBLE'

for i in b:
  for k in range(M):
    if a[k][0] == a[i][1]:
      if a[k][1] == N:
         res = 'POSSIBLE'
print (res)

Fixed submission:
import sys 

N,M  = map(int,input().split())
     
a = [[0 for i in range(2)] for j in range(M)]
b = [] 
c = []

for i in range(M):
  a[i][0] , a[i][1] = map(int,input().split())
  first, second = a[i][0],a[i][1]
  if first == 1:
    b.append(second)
  if second == N:
    c.append(first)

b_set = set(b)
c_set = set(c)

if list(b_set & c_set) is None or len(list(b_set & c_set)):
  res = ('POSSIBLE')
else:
  res = ('IMPOSSIBLE')

print(res)

Buggy python submission (verdict: Time Limit Exceeded):
import sys 
     
N,M  = map(int,input().split())
     
a = [[0 for i in range(2)] for j in range(M)]
     
for l in range(M):
  a[l][0] , a[l][1] = map(int,input().split())
     
for l in range(M):
   if a[l][0] == 1:
     for k in range(M):
      if a[k][0] == a[l][1]:
        if a[k][1] == N:
          print('POSSIBLE')
          sys.exit()
print ('IMPOSSIBLE')

Fixed submission:
import sys 

N,M  = map(int,input().split())
     
a = [[0 for i in range(2)] for j in range(M)]
b = [] 
c = []

for i in range(M):
  a[i][0] , a[i][1] = map(int,input().split())
  first, second = a[i][0],a[i][1]
  if first == 1:
    b.append(second)
  if second == N:
    c.append(first)

b_set = set(b)
c_set = set(c)

if list(b_set & c_set) is None or len(list(b_set & c_set)):
  res = ('POSSIBLE')
else:
  res = ('IMPOSSIBLE')

print(res)

Buggy python submission (verdict: Runtime Error):
n,m = map(int,input().split())
des = [0]*(n+1)
a = 1

for i in range(0,m):
  b = (list(map(int,input().split()))
  if b[0] == 1:
    des[b[1]] += 1
    if des[b[1]] == 2:
      print('possible')
      a = 0
      break
    
    if b[1]  == n:
      des[b[0]] += 1
      if des[b[0]] == 2:
        print ('possible')
        a = 0
        break
if a:
  print('impossible')

Fixed submission:
import sys 

N,M  = map(int,input().split())
     
a = [[0 for i in range(2)] for j in range(M)]
b = [] 
c = []

for i in range(M):
  a[i][0] , a[i][1] = map(int,input().split())
  first, second = a[i][0],a[i][1]
  if first == 1:
    b.append(second)
  if second == N:
    c.append(first)

b_set = set(b)
c_set = set(c)

if list(b_set & c_set) is None or len(list(b_set & c_set)):
  res = ('POSSIBLE')
else:
  res = ('IMPOSSIBLE')

print(res)

Buggy python submission (verdict: Runtime Error):
n, m = map(int, input().split())
des= [0]*(n+1)
a = 1
for i in range(0, m):
    b = (list(map(int, input().split())))
    if b[0] == 1:
    	des[b[1]] += 1
    	if des[b[1]] == 2:
    		print('POSSIBLE')
    		a = 0
    		break
    if b[1] == n:
    	des[b[0]] += 1
    	if des[b[0]] == 2:
    		print('POSSIBLE')
    	        a = 0
    		break
    		
if a:
    print('IMPOSSIBLE')

Fixed submission:
import sys 

N,M  = map(int,input().split())
     
a = [[0 for i in range(2)] for j in range(M)]
b = [] 
c = []

for i in range(M):
  a[i][0] , a[i][1] = map(int,input().split())
  first, second = a[i][0],a[i][1]
  if first == 1:
    b.append(second)
  if second == N:
    c.append(first)

b_set = set(b)
c_set = set(c)

if list(b_set & c_set) is None or len(list(b_set & c_set)):
  res = ('POSSIBLE')
else:
  res = ('IMPOSSIBLE')

print(res)

Buggy python submission (verdict: Runtime Error):
    n, m = map(int, input().split())
    des= [0]*(n+1)
    a = 1
    for i in range(0, m):
    	b = (list(map(int, input().split())))
    	if b[0] == 1:
    		des[b[1]] += 1
    		if des[b[1]] == 2:
    			print('POSSIBLE')
    			a = 0
    			break
    	if b[1] == n:
    		des[b[0]] += 1
    		if des[b[0]] == 2:
    			print('POSSIBLE')
    			a = 0
    			break
    		
    if a:
    	print('IMPOSSIBLE')

Fixed submission:
import sys 

N,M  = map(int,input().split())
     
a = [[0 for i in range(2)] for j in range(M)]
b = [] 
c = []

for i in range(M):
  a[i][0] , a[i][1] = map(int,input().split())
  first, second = a[i][0],a[i][1]
  if first == 1:
    b.append(second)
  if second == N:
    c.append(first)

b_set = set(b)
c_set = set(c)

if list(b_set & c_set) is None or len(list(b_set & c_set)):
  res = ('POSSIBLE')
else:
  res = ('IMPOSSIBLE')

print(res)

Buggy python submission (verdict: Runtime Error):
# coding: utf-8
     
    N, M = tuple(map(int, input().split()))
     
    graph = [ [] for i in range(N+1)]
    for i in range(M):
        a, b = tuple(map(int, input().split()))
        graph[a].append(b)
        graph[b].append(a)
     
    res = "IMPOSSIBLE"
    for i in range(2, N):
        if 1 in graph[i] and N in graph[i]:
            res = "POSSIBLE"
     
    print(res)




Fixed submission:
import sys 

N,M  = map(int,input().split())
     
a = [[0 for i in range(2)] for j in range(M)]
b = [] 
c = []

for i in range(M):
  a[i][0] , a[i][1] = map(int,input().split())
  first, second = a[i][0],a[i][1]
  if first == 1:
    b.append(second)
  if second == N:
    c.append(first)

b_set = set(b)
c_set = set(c)

if list(b_set & c_set) is None or len(list(b_set & c_set)):
  res = ('POSSIBLE')
else:
  res = ('IMPOSSIBLE')

print(res)