Buggy python submission (verdict: Time Limit Exceeded):
n, m = map(int, input().split())
first = [0]
a = 1
for i in range(0, m):
	b = (list(map(int, input().split())))
	if b[0] == 1:
		if b[1] in first:
			print('POSSIBLE')
			a = 0
			break
		else:
			first.append(b[1])
	if b[1] == n:
		if b[0] in first:
			print('POSSIBLE')
			a = 0
			break
		else:
			first.append(b[0])
		
if a:
	print('IMPOSSIBLE')

Fixed submission:
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')

Buggy python submission (verdict: Time Limit Exceeded):
n, m = map(int, input().split())
des = [0]*n
first = [0]*m
second = [0]*m
a = 1
for i in range(0, m):
	b = (list(map(int, input().split())))
	if b[0] == 1:
		first.append(b[1])
		if b[1] in second:
			print('POSSIBLE')
			a = 0
			break
	if b[1] == n:
		second.append(b[0])
		if b[0] in first:
			print('POSSIBLE')
			a = 0
			break
		
if a:
	print('IMPOSSIBLE')





Fixed submission:
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')

Buggy python submission (verdict: Time Limit Exceeded):
n, m = map(int, input().split())
des = []
first = []
second = []
a = 1
for i in range(0, m):
	b = (list(map(int, input().split())))
	if b[0] == 1:
		first.append(b[1])
		if b[1] in second:
			print('POSSIBLE')
			a = 0
			break
	if b[1] == n:
		second.append(b[0])
		if b[0] in first:
			print('POSSIBLE')
			a = 0
			break
		
if a:
	print('IMPOSSIBLE')

Fixed submission:
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')

Buggy python submission (verdict: Time Limit Exceeded):
n, m = map(int, input().split())
des = []
first = []
second = []
a = 1
for i in range(0, m):
	b = (list(map(int, input().split())))
	if b[0] == 1:
		first.append(b[1])
		if b[1] in second:
			print('POSSIBLE')
			a = 0
			break
	if b[1] == n:
		second.append(b[0])
		if b[0] in first:
			print('POSSIBLE')
			a = 0
			break
		
if a:
	print('IMPOSSIBLE')





Fixed submission:
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')

Buggy python submission (verdict: Time Limit Exceeded):
n, m = map(int, input().split())
des = []
first = []
second = []
a = 1
for i in range(0, m):
	b = (list(map(int, input().split())))
	if b[0] == 1:
		first.append(b[1])
	if b[1] == n:
		second.append(b[0])

for i in first:
	if i in second:
		print('POSSIBLE')
		a = 0
		break

if a:
	print('IMPOSSIBLE')





Fixed submission:
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')

Buggy python submission (verdict: Time Limit Exceeded):
n, m = map(int, input().split())
des = []
first = []
second = []
a = 1
for i in range(0, m):
	b = (list(map(int, input().split())))
	if b[0] == 1:
		first.append(b[1])
	if b[1] == n:
		second.append(b[0])
###以上1から行ける場所をfirstに格納 終点につながるとこをsecondに格納

for i in first:
	if i in second:
		print('POSSIBLE')
		a = 0
		break

if a:
	print('IMPOSSIBLE')





Fixed submission:
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')

Buggy python submission (verdict: Time Limit Exceeded):
n, m = map(int, input().split())
des = []
first = []
second = []
a = 1
for i in range(0, m):
	des.append(list(map(int, input().split())))
###ここまで入力
###以下出力
for i in des:
	if i[0] == 1:
		first.append(i[1])
	if i[1] == n:
		second.append(i[0])
###以上1から行ける場所をfirstに格納 終点につながるとこをsecondに格納

for i in first:
	if i in second:
		print('POSSIBLE')
		a = 0
		break

if a:
	print('IMPOSSIBLE')





Fixed submission:
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')

Buggy python submission (verdict: Time Limit Exceeded):
n, m = map(int, input().split())
des = []
first = []
a = 1 ###IMPOSSIBLEフラグ
for i in range(0, m):
	des.append(list(map(int, input().split())))
###ここまで入力
###以下出力
for i in des:
	if i[0] == 1:
		first.append(i[1])
###以上1から行ける場所をfirstに格納
for i in des:
	if first.count(i[0]):
		if i[1] == n:
			print('POSSIBLE')
			a = 0
			break

if a:
	print('IMPOSSIBLE')





Fixed submission:
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')