In Takahashi Kingdom, there is an archipelago of N islands, called Takahashi Islands.
For convenience, we will call them Island 1, Island 2, ..., Island N.
There are M kinds of regular boat services between these islands.
Each service connects two islands. The i-th service connects Island a_i and Island b_i.
Cat Snuke is on Island 1 now, and wants to go to Island N.
However, it turned out that there is no boat service from Island 1 to Island N, so he wants to know whether it is possible to go to Island N by using two boat services.
Help him.

-----Constraints-----
 - 3 ≤ N ≤ 200 000
 - 1 ≤ M ≤ 200 000
 - 1 ≤ a_i < b_i ≤ N
 - (a_i, b_i) \neq (1, N)
 - If i \neq j, (a_i, b_i) \neq (a_j, b_j).

-----Input-----
Input is given from Standard Input in the following format:
N M
a_1 b_1
a_2 b_2
:
a_M b_M

-----Output-----
If it is possible to go to Island N by using two boat services, print POSSIBLE; otherwise, print IMPOSSIBLE.

-----Sample Input-----
3 2
1 2
2 3

-----Sample Output-----
POSSIBLE

Source: atcoder | Difficulty: EASY


Solutions:
(n, m) = list(map(int, input().split()))
M = [[] for i in range(n)]
for i in range(m):
	(a, b) = list(map(int, input().split()))
	a -= 1
	b -= 1
	M[a].append(b)
	M[b].append(a)
yes = 'POSSIBLE'
no = 'IMPOSSIBLE'
for i in M[0]:
	if n - 1 in M[i]:
		print(yes)
		return
print(no)


import sys
input = sys.stdin.readline
(n, m) = list(map(int, input().split()))
x = set()
y = set()
for _ in range(m):
	(a, b) = list(map(int, input().split()))
	if a == 1:
		x.add(b)
	if b == n:
		y.add(a)
print(('POSSIBLE', 'IMPOSSIBLE')[len(x & y) == 0])


import os
import sys
from collections import deque

def main():
	(N, M) = list(map(int, input().split()))
	path = [[] for _ in range(N + 1)]
	for _ in range(M):
		(a, b) = list(map(int, input().split()))
		path[a].append(b)
		path[b].append(a)
	Q = deque(path[1])
	flag = False
	while Q and flag is False:
		u = Q.popleft()
		for v in path[u]:
			if v == N:
				flag = True
	if flag:
		print('POSSIBLE')
	else:
		print('IMPOSSIBLE')

def __starting_point():
	main()
__starting_point()


from collections import deque
(n, m) = list(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]) = list(map(int, input().split()))
if m == 1:
	print('IMPOSSIBLE')
	return
to = [[] for _ in range(n + 1)]
for i in range(m):
	to[a[i]].append(b[i])
	to[b[i]].append(a[i])
inf = 200200
dist = [inf for _ in range(n + 1)]
q = deque()
q.append(1)
dist[1] = 0
while q:
	v = q.popleft()
	for u in to[v]:
		if dist[u] == inf:
			dist[u] = dist[v] + 1
			q.append(u)
if dist[n] == 2:
	print('POSSIBLE')
else:
	print('IMPOSSIBLE')


import collections as c
(n, m) = map(int, input().split())
print(['POSSIBLE', 'IMPOSSIBLE'][not [1 for c in c.Counter([[a, b][a == 1] for (a, b) in [[i, j] for (i, j) in [list(map(int, input().split())) for _ in range(m)] if i == 1 or j == n]]).values() if c > 1]])


(n, m) = [int(x) for x in input().split()]
a = []
for i in range(m):
	a.append([int(x) for x in input().split()])
res = 'IMPOSSIBLE'
flag = []
for i in range(m):
	if a[i][0] == 1:
		flag.append(a[i][1])
flag = set(flag)
for i in range(m):
	if a[i][0] in flag and a[i][1] == n:
		res = 'POSSIBLE'
print(res)


import collections
(n, m) = list(map(int, input().split()))
(a, b, c) = ([], [], [])
for i in range(m):
	A = list(map(int, input().split()))
	a.append(A)
for i in range(m):
	if a[i][1] == n:
		b.append(a[i][0])
	elif a[i][0] == 1:
		c.append(a[i][1])
if len(set(b) & set(c)) > 0:
	print('POSSIBLE')
else:
	print('IMPOSSIBLE')


(n, m) = map(int, input().split())
edge = [[] for _ in range(n)]
for i in range(m):
	(x, y) = map(int, input().split())
	edge[x - 1].append(y - 1)
	edge[y - 1].append(x - 1)
for i in edge[0]:
	if n - 1 in edge[i]:
		print('POSSIBLE')
		return
print('IMPOSSIBLE')


import math
import collections
import fractions
import itertools
import functools
import operator
import bisect

def solve():
	(n, m) = map(int, input().split())
	course = [[] for i in range(n)]
	for i in range(m):
		(a, b) = map(int, input().split())
		course[a - 1].append(b)
		course[b - 1].append(a)
	for i in course[0]:
		if n in course[i - 1]:
			print('POSSIBLE')
			break
	else:
		print('IMPOSSIBLE')
	return 0

def __starting_point():
	solve()
__starting_point()


(n, m) = map(int, input().split())
arr_ = [tuple(map(int, input().split())) for _ in range(m)]
one = set([b for (a, b) in arr_ if a == 1])
last = set([a for (a, b) in arr_ if b == n])
print('POSSIBLE' if len(one & last) >= 1 else 'IMPOSSIBLE')


import heapq
import sys
input = lambda : sys.stdin.readline().rstrip()

def INPUT(mode=int):
	return list(map(mode, input().split()))

def Dijkstra_heap(s, edge):
	d = [10 ** 20] * n
	used = [False] * n
	d[s] = 0
	used[s] = True
	edgelist = []
	for (i, j) in edge[s]:
		heapq.heappush(edgelist, i + j * 10 ** 6)
	while len(edgelist):
		minedge = heapq.heappop(edgelist)
		v = minedge % 10 ** 6
		if used[v]:
			continue
		d[v] = minedge // 10 ** 6
		used[v] = True
		for e in edge[v]:
			if not used[e[0]]:
				heapq.heappush(edgelist, e[0] + (e[1] + d[v]) * 10 ** 6)
	return d
(n, m) = INPUT()
AB = [INPUT() for _ in range(m)]
edge = [[] for _ in range(n)]
for (a, b) in AB:
	a -= 1
	b -= 1
	edge[a].append((b, 1))
	edge[b].append((a, 1))
dist = Dijkstra_heap(0, edge)
if dist[-1] <= 2:
	print('POSSIBLE')
else:
	print('IMPOSSIBLE')


(n, m) = map(int, input().split())
ab = [list(map(int, input().split())) for _ in range(m)]
ini_1 = []
end_n = []
for i in range(m):
	if ab[i][0] == 1:
		ini_1.append(ab[i][1])
	elif ab[i][1] == n:
		end_n.append(ab[i][0])
if set(ini_1) & set(end_n):
	print('POSSIBLE')
else:
	print('IMPOSSIBLE')


(n, m) = map(int, input().split())
l1 = set()
l2 = set()
for i in range(m):
	(a, b) = map(int, input().split())
	if a == 1:
		l1.add(b)
	elif b == n:
		l2.add(a)
print('POSSIBLE' if len(l1 & l2) >= 1 else 'IMPOSSIBLE')


(N, M) = map(int, input().split())
ship = [list(map(int, input().split())) for _ in range(M)]
s1 = [False] * N
sN = [False] * N
for (i, s) in enumerate(ship):
	if s[0] == 1:
		s1[s[1] - 1] = True
	if s[1] == N:
		sN[s[0] - 1] = True
ans = 'IMPOSSIBLE'
if any([p1 * pN for (p1, pN) in zip(s1, sN)]):
	ans = 'POSSIBLE'
print(ans)


import sys
input = sys.stdin.readline

def read():
	(N, M) = list(map(int, input().strip().split()))
	AB = []
	for i in range(M):
		(a, b) = list(map(int, input().strip().split()))
		AB.append((a, b))
	return (N, M, AB)

def solve(N, M, AB):
	S = [False for i in range(N + 1)]
	T = [False for i in range(N + 1)]
	for (a, b) in AB:
		if a > b:
			(a, b) = (b, a)
		if a == 1:
			S[b] = True
		elif b == N:
			T[a] = True
	for (s, t) in zip(S, T):
		if s and t:
			return 'POSSIBLE'
	return 'IMPOSSIBLE'

def __starting_point():
	inputs = read()
	print('%s' % solve(*inputs))
__starting_point()


(n, m) = list(map(int, input().split()))
dic = {}
for i in range(m):
	(a, b) = list(map(int, input().split()))
	dic[a, b] = True
	dic[b, a] = True
ans = 'IMPOSSIBLE'
for i in range(2, n):
	if dic.get((1, i), False):
		if dic.get((i, n), False):
			ans = 'POSSIBLE'
			break
print(ans)


(N, M) = list(map(int, input().split()))
a = []
b = []
for i in range(M):
	(x, y) = list(map(int, input().split()))
	a.append(x)
	b.append(y)
c = []
d = []
for i in range(M):
	if a[i] == 1:
		c.append(b[i])
for i in range(M):
	if b[i] == N:
		d.append(a[i])
e = set(c) & set(d)
if len(e) != 0:
	print('POSSIBLE')
else:
	print('IMPOSSIBLE')


(n, m) = map(int, input().split())
a1 = []
bn = []
for i in range(m):
	(a, b) = map(int, input().split())
	if a == 1:
		a1.append(b)
	elif b == n:
		bn.append(a)
la = len(a1)
lb = len(bn)
sa = set(a1)
sb = set(bn)
if len(sa | sb) < la + lb:
	print('POSSIBLE')
	return
print('IMPOSSIBLE')


import sys
(n, m) = map(int, input().split())
g = [[] for _ in range(n)]
for _ in range(m):
	(u, v) = map(int, input().split())
	g[u - 1].append(v - 1)
	g[v - 1].append(u - 1)
N = n - 1
for i in g[0]:
	if N in g[i]:
		print('POSSIBLE')
		return
print('IMPOSSIBLE')


(N, M) = map(int, input().split())
island = [[] for i in range(N + 1)]
for i in range(M):
	(a, b) = map(int, input().split())
	island[a].append(b)
for i in island[1]:
	if N in island[i]:
		print('POSSIBLE')
		return
print('IMPOSSIBLE')


(n, m) = map(int, input().split())
arr = []
for i in range(m):
	(a, b) = map(int, input().split())
	arr.append((a, b))
one = set([b for (a, b) in arr if a == 1])
last = set([a for (a, b) in arr if b == n])
connect = one & last
if len(connect) >= 1:
	print('POSSIBLE')
else:
	print('IMPOSSIBLE')


(N, M) = list(map(int, input().split()))
G = [list() for _ in range(N)]
for _ in range(M):
	(a, b) = list(map(int, input().split()))
	a -= 1
	b -= 1
	G[a].append(b)
	G[b].append(a)
G[0].sort()
G[N - 1].sort()
i = 0
j = 0
while i < len(G[0]) and j < len(G[N - 1]):
	if G[0][i] == G[N - 1][j]:
		print('POSSIBLE')
		break
	elif G[0][i] < G[N - 1][j]:
		i += 1
	else:
		j += 1
else:
	print('IMPOSSIBLE')


(n, m) = list(map(int, input().split()))
root_map = dict()
root_map[1] = set()
root_map[n] = set()
for i in range(m):
	(a, b) = list(map(int, input().split()))
	if a == 1 or a == n:
		root_map[a].add(b)
	if b == 1 or b == n:
		root_map[b].add(a)
if root_map[1] & root_map[n]:
	print('POSSIBLE')
else:
	print('IMPOSSIBLE')


(N, M) = list(map(int, input().split()))
nekotyann = [0] * N
wanntyann = [0] * N
ans = 'IMPOSSIBLE'
for i in range(M):
	(a, b) = list(map(int, input().split()))
	if a == 1:
		nekotyann[b - 1] += 1
	if b == N:
		wanntyann[a - 1] += 1
for k in range(N):
	if nekotyann[k] != 0 and wanntyann[k] != 0:
		ans = 'POSSIBLE'
		break
print(ans)


(N, M) = map(int, input().split())
ans = 'IMPOSSIBLE'
f1tob = []
fbtoN = []
for i in range(M):
	(a, b) = map(int, input().split())
	if a == 1:
		f1tob.append(b)
	elif b == N:
		fbtoN.append(a)
f1toba = set(f1tob)
fbtoNa = set(fbtoN)
if bool(fbtoNa & f1toba):
	ans = 'POSSIBLE'
print(ans)


(n, m) = map(int, input().split())
edges = [tuple(map(int, input().split())) for _ in range(m)]
G = [[] for j in range(n + 1)]
for (a, b) in edges:
	G[a].append(b)
	G[b].append(a)
for b in G[1]:
	if n in G[b]:
		print('POSSIBLE')
		return
print('IMPOSSIBLE')


(n, m) = list(map(int, input().split()))
dic = {}
isOK = False
for i in range(m):
	(a, b) = list(map(int, input().split()))
	if a in [1, n]:
		dic.setdefault(b, 0)
		dic[b] += 1
		if dic[b] == 2:
			isOK = True
			break
	elif b in [1, n]:
		dic.setdefault(a, 0)
		dic[a] += 1
		if dic[a] == 2:
			isOK = True
			break
if isOK:
	print('POSSIBLE')
else:
	print('IMPOSSIBLE')


(N, M) = map(int, input().split())
g = [[] for i in range(N)]
for i in range(M):
	(a, b) = map(int, input().split())
	g[a - 1].append(b)
	g[b - 1].append(a)
ls = g[0]
flag = 0
for i in range(len(g[0])):
	ls2 = g[ls[i] - 1]
	for j in range(len(ls2)):
		if ls2[j] == N:
			flag += 1
			print('POSSIBLE')
			break
if flag == 0:
	print('IMPOSSIBLE')


(N, M) = list(map(int, input().split()))
from_one = []
to_n = []
for _ in range(M):
	(a, b) = [int(x) - 1 for x in input().split()]
	if a == 0:
		from_one += [b]
	elif b == 0:
		from_one += [a]
	elif a == N - 1:
		to_n += [b]
	elif b == N - 1:
		to_n += [a]
from_one = set(from_one)
to_n = set(to_n)
if len(from_one & to_n) >= 1:
	print('POSSIBLE')
else:
	print('IMPOSSIBLE')


(N, M) = map(int, input().split())
I = set()
n = set()
for i in range(M):
	(a, b) = map(int, input().split())
	if a == 1:
		I.add(b)
	if b == N:
		n.add(a)
if I & n == set():
	print('IMPOSSIBLE')
else:
	print('POSSIBLE')


(N, M) = map(int, input().split())
(l, r) = ([0] * N, [0] * N)
for i in range(M):
	(a, b) = map(int, input().split())
	if a == 1:
		l[b - 1] = 1
	if b == N:
		r[a - 1] = 1
for i in range(N):
	if l[i] + r[i] == 2:
		print('POSSIBLE')
		return
print('IMPOSSIBLE')


(N, M) = map(int, input().split())
graph = [[] for _ in range(N)]
for _ in range(M):
	(a, b) = map(int, input().split())
	graph[a - 1].append(b - 1)
	graph[b - 1].append(a - 1)

def bfs(goal, graph, seen, next_v):
	for x in graph[next_v[0][0]]:
		if x == goal:
			return True
		if x in seen:
			continue
		next_v.append((x, next_v[0][1] + 1))
		seen.add(x)
	return False
next_v = [(0, 0)]
seen = {0}
while True:
	if len(next_v) == 0 or next_v[0][1] == 2:
		ans = 'IMPOSSIBLE'
		break
	if bfs(N - 1, graph, seen, next_v):
		ans = 'POSSIBLE'
		break
	next_v.pop(0)
print(ans)


(N, M) = [int(x) for x in input().split(' ')]
next_to_1 = []
next_to_last = []
for i in range(M):
	tmp = input().split(' ')
	if int(tmp[0]) == 1:
		next_to_1.append(int(tmp[1]))
	if int(tmp[1]) == N:
		next_to_last.append(int(tmp[0]))
if len(list(set(next_to_1) & set(next_to_last))) > 0:
	print('POSSIBLE')
else:
	print('IMPOSSIBLE')


from collections import deque
(n, m) = list(map(int, input().split()))
edges = [[] * n for _ in range(n)]
for _ in range(m):
	(a, b) = list(map(int, input().split()))
	a -= 1
	b -= 1
	edges[a].append(b)
	edges[b].append(a)
d = deque()
d.append(0)
visited = [False] * n
visited[0] = True
from_0 = [0] * n
while d:
	x = d.popleft()
	for child in edges[x]:
		if visited[child]:
			continue
		else:
			visited[child] = True
			d.append(child)
			from_0[child] = from_0[x] + 1
if from_0[n - 1] == 2:
	print('POSSIBLE')
else:
	print('IMPOSSIBLE')


(n, m) = map(int, input().split())
voyage = [set() for i in range(n + 1)]
for i in range(m):
	(a, b) = map(int, input().split())
	voyage[a].add(b)
	voyage[b].add(a)
ans = 0
for v in voyage[1]:
	if v in voyage[n]:
		ans = 1
print('POSSIBLE' if ans else 'IMPOSSIBLE')


(n, m) = list(map(int, input().split()))
ab = [list(map(int, input().split())) for i in range(m)]
ren = []
for i in range(m):
	if ab[i][0] == 1:
		ren.append(ab[i][1])
	elif ab[i][1] == n:
		ren.append(ab[i][0])
cnt = len(ren)
if len(set(ren)) == cnt:
	print('IMPOSSIBLE')
else:
	print('POSSIBLE')


(N, M) = map(int, input().split())
A = set()
B = set()
for i in range(M):
	(a, b) = input().split()
	if a == '1':
		A.add(b)
	if b == str(N):
		B.add(a)
if A & B:
	print('POSSIBLE')
else:
	print('IMPOSSIBLE')


from collections import deque
(n, m) = map(int, input().split())
e = [[] for i in range(n)]
for i in range(m):
	(f, t) = map(int, input().split())
	f -= 1
	t -= 1
	e[f].append(t)
	e[t].append(f)
INF = 10 ** 9
dist = [INF] * n
dist[0] = 0
d = deque()
d.append([0, 0])
while d:
	(f, c) = d.pop()
	if c >= 2:
		break
	for t in e[f]:
		if c + 1 < dist[t]:
			dist[t] = c + 1
			d.appendleft([t, c + 1])
print('POSSIBLE') if dist[n - 1] <= 2 else print('IMPOSSIBLE')


(n, m) = list(map(int, input().split()))
ab = list((list(map(int, input().split())) for _ in range(m)))
goal = [0] * n
start = [0] * n
for (a, b) in ab:
	if a == 1:
		start[b] = 1
	if b == n:
		goal[a] = 1
flg = False
for i in range(n):
	if start[i] and goal[i]:
		flg = True
print('POSSIBLE' if flg else 'IMPOSSIBLE')


(n, m) = map(int, input().split())
li = [0] * 200001
s = 'IMPOSSIBLE'
for i in range(m):
	(a, b) = map(int, input().split())
	if a == 1:
		if li[b] == 0:
			li[b] = 1
		else:
			s = 'POSSIBLE'
	if b == n:
		if li[a] == 0:
			li[a] = 1
		else:
			s = 'POSSIBLE'
print(s)


import sys
YES = 'POSSIBLE'
NO = 'IMPOSSIBLE'

def solve(N: int, M: int, a: 'List[int]', b: 'List[int]'):
	AB = sorted(zip(a, b))
	s = set([b for (a, b) in AB if a == 1])
	g = set([a for (a, b) in AB if b == N])
	return YES if s & g else NO

def main():

	def iterate_tokens():
		for line in sys.stdin:
			for word in line.split():
				yield word
	tokens = iterate_tokens()
	N = int(next(tokens))
	M = int(next(tokens))
	a = [int()] * M
	b = [int()] * M
	for i in range(M):
		a[i] = int(next(tokens))
		b[i] = int(next(tokens))
	print(solve(N, M, a, b))

def test():
	import doctest
	doctest.testmod()

def perf():
	import cProfile
	cProfile.run('main()')

def __starting_point():
	main()
__starting_point()


(N, M) = map(int, input().split())
A = []
B = []
for i in range(M):
	(a, b) = map(int, input().split())
	if a == 1:
		B.append(b)
	if b == N:
		A.append(a)
if len(set(A) & set(B)) != 0:
	print('POSSIBLE')
else:
	print('IMPOSSIBLE')


import sys
input = sys.stdin.readline

def read():
	(N, M) = list(map(int, input().strip().split()))
	AB = []
	for i in range(M):
		(a, b) = list(map(int, input().strip().split()))
		AB.append((a, b))
	return (N, M, AB)

def solve(N, M, AB):
	is_ok = True
	mid_b = set()
	mid_a = set()
	for (a, b) in AB:
		if a == 1:
			mid_b.add(b)
		elif b == N:
			mid_a.add(a)
	is_ok = len(mid_a.intersection(mid_b)) > 0
	return 'POSSIBLE' if is_ok else 'IMPOSSIBLE'

def __starting_point():
	inputs = read()
	print(solve(*inputs))
__starting_point()


(n, m) = map(int, input().split())
A = []
B = []
for i in range(m):
	(a, b) = map(int, input().split())
	if a == 1:
		A.append(b)
	if b == n:
		B.append(a)
if len(set(A) & set(B)) > 0:
	print('POSSIBLE')
else:
	print('IMPOSSIBLE')


(N, M) = [int(x) for x in input().split()]
AB = [[int(x) for x in input().split()] for _ in range(M)]
x = set()
for (a, b) in AB:
	if a == 1:
		x.add(b)
	if b == 1:
		x.add(a)
f = False
for (a, b) in AB:
	if a in x and b == N or (b in x and a == N):
		f = True
if f:
	print('POSSIBLE')
else:
	print('IMPOSSIBLE')


import sys
(N, M) = [int(i) for i in input().split()]
map = {k: [] for k in range(1, N + 1)}
for _ in range(M):
	(a, b) = (int(i) for i in input().split())
	map[a].append(b)
for i in map[1]:
	if N in map[i]:
		print('POSSIBLE')
		return
print('IMPOSSIBLE')


from collections import deque
(n, m) = map(int, input().split())
G = [[] for _ in range(n)]
for i in range(m):
	(a, b) = map(int, input().split())
	a -= 1
	b -= 1
	G[a].append(b)
	G[b].append(a)
ok = False
for v in G[0]:
	s = G[v]
	if n - 1 in s:
		ok = True
if ok:
	print('POSSIBLE')
else:
	print('IMPOSSIBLE')


(n, m) = map(int, input().split())
init_island = set()
last_island = set()
for _ in range(m):
	(a, b) = map(int, input().split())
	(a, b) = (min(a, b), max(a, b))
	if a == 1:
		init_island.add(b)
	elif b == n:
		last_island.add(a)
	else:
		continue
common = init_island.intersection(last_island)
if len(common) >= 1:
	print('POSSIBLE')
else:
	print('IMPOSSIBLE')


(N, M) = list(map(int, input().split()))
L = [list(map(int, input().split())) for i in range(M)]
s = []
g = []
for i in range(M):
	if 1 == L[i][0]:
		s.append(L[i][1])
	if 1 == L[i][1]:
		s.append(L[i][0])
for i in range(M):
	if N == L[i][0]:
		g.append(L[i][1])
	if N == L[i][1]:
		g.append(L[i][0])
if set(g) & set(s):
	print('POSSIBLE')
else:
	print('IMPOSSIBLE')


(n, m, *AB) = map(int, open(0).read().split())
(C, D) = (set(), set())
for (a, b) in zip(AB[::2], AB[1::2]):
	if a == 1:
		C.add(b)
	if b == n:
		D.add(a)
if len(C & D):
	print('POSSIBLE')
else:
	print('IMPOSSIBLE')


def main():
	(N, M) = map(int, input().split())
	fromOne = set()
	toM = set()
	for i in range(M):
		(a, b) = map(int, input().split())
		if a == 1:
			fromOne.add(b)
		elif b == N:
			toM.add(a)
	return 'POSSIBLE' if fromOne & toM else 'IMPOSSIBLE'
print(main())


(N, M) = list(map(int, input().split()))
start = set()
goal = set()
for i in range(M):
	(a, b) = list(map(int, input().split()))
	if a == 1:
		start.add(b)
	elif b == N:
		goal.add(a)
print('IMPOSSIBLE' if len(start & goal) == 0 else 'POSSIBLE')


(N, M) = list(map(int, input().split()))
AB = [list(map(int, input().split())) for _ in range(M)]
res = []
for (a, b) in AB:
	if a == 1:
		res.append(b)
	if b == N:
		res.append(a)
print('IMPOSSIBLE' if len(res) == len(set(res)) else 'POSSIBLE')


import sys
from io import StringIO
import unittest

class TestClass(unittest.TestCase):

	def assertIO(self, input, output):
		(stdout, stdin) = (sys.stdout, sys.stdin)
		(sys.stdout, sys.stdin) = (StringIO(), StringIO(input))
		resolve()
		sys.stdout.seek(0)
		out = sys.stdout.read()[:-1]
		(sys.stdout, sys.stdin) = (stdout, stdin)
		self.assertEqual(out, output)

	def test_入力例_1(self):
		input = '3 2\n1 2\n2 3'
		output = 'POSSIBLE'
		self.assertIO(input, output)

	def test_入力例_2(self):
		input = '4 3\n1 2\n2 3\n3 4'
		output = 'IMPOSSIBLE'
		self.assertIO(input, output)

	def test_入力例_3(self):
		input = '100000 1\n1 99999'
		output = 'IMPOSSIBLE'
		self.assertIO(input, output)

	def test_入力例_4(self):
		input = '5 5\n1 3\n4 5\n2 3\n2 4\n1 4'
		output = 'POSSIBLE'
		self.assertIO(input, output)

def resolve():
	(N, M) = list(map(int, input().split()))
	S = [0] * N
	E = [0] * N
	for i in range(M):
		(a, b) = list(map(int, input().split()))
		if a == 1:
			S[b - 1] = 1
		if b == N:
			E[a - 1] = 1
	ans = 'IMPOSSIBLE'
	for i in range(N):
		if S[i] == E[i] == 1:
			ans = 'POSSIBLE'
			break
	print(ans)

def __starting_point():
	resolve()
__starting_point()


(n, m) = map(int, input().split())
a = [list(map(int, input().split())) for _ in range(m)]
pot_starts = []
pot_ends = []
for i in a:
	if i[0] == 1:
		pot_starts.append(i[1])
	elif i[1] == n:
		pot_ends.append(i[0])
if set(pot_starts).intersection(set(pot_ends)):
	print('POSSIBLE')
else:
	print('IMPOSSIBLE')


def main():
	(n, m) = map(int, input().split())
	ab_lst = []
	for i in range(m):
		ab_lst.append(list(map(int, input().split())))
	flag = False
	lst = []
	for i in range(m):
		a = ab_lst[i][0]
		b = ab_lst[i][1]
		if a == 1:
			lst.append(b)
	st = set(lst)
	for i in range(m):
		a = ab_lst[i][0]
		b = ab_lst[i][1]
		if b == n:
			if a in st:
				flag = True
				break
	if flag:
		print('POSSIBLE')
	else:
		print('IMPOSSIBLE')

def __starting_point():
	main()
__starting_point()


(N, M) = map(int, input().split())
ki = [list() for i in range(N)]
for _ in range(M):
	(a, b) = map(int, input().split())
	a -= 1
	b -= 1
	ki[a].append(b)
K = [-1] * N

def dfs(now, time):
	K[now] = time
	for i in ki[now]:
		time += 1
		dfs(i, time)
		time -= 1
dfs(0, 0)
print('POSSIBLE' if K[N - 1] == 2 else 'IMPOSSIBLE')


(n, m) = map(int, input().split())
X = [list(map(int, input().split())) for i in range(m)]
a_list = []
b_list = []
for i in range(m):
	if X[i][0] == 1:
		a_list.append(X[i][1])
	elif X[i][1] == n:
		b_list.append(X[i][0])
c_set = set(a_list) & set(b_list)
if len(c_set) == 0:
	print('IMPOSSIBLE')
else:
	print('POSSIBLE')


(n, m) = map(int, input().split())
re = [[] for i in range(n + 1)]
for i in range(m):
	(a, b) = map(int, input().split())
	re[a].append(b)
	re[b].append(a)
reach = [0] * (n + 1)
reach[1] = 1
for i in re[1]:
	if reach[i] == 0:
		for j in re[i]:
			reach[j] = 1
if reach[n] == 1:
	print('POSSIBLE')
else:
	print('IMPOSSIBLE')


import typing
from typing import Deque, Set, Dict

class Island:

	def __init__(self, id: int) -> None:
		self.id: int = id
		self.connection: List['Island'] = []
		self.rank: int = 0

	def addConnection(self, other: 'Island') -> None:
		self.connection.append(other)
		other.connection.append(self)

	def setRank(self, other: 'Island') -> None:
		self.rank = other.rank + 1

class Islands(Dict[int, Island]):

	def __init__(self, num: int):
		for id in range(1, num + 1):
			self[id] = Island(id)

def bfs(root: Island, max_depth: int) -> None:
	reserved: Deque[Island] = Deque([root])
	seen: Set[int] = {root.id}
	while len(reserved) != 0:
		current: Island = reserved.popleft()
		if current.rank > max_depth:
			break
		for connected in current.connection:
			if connected.id in seen:
				continue
			connected.setRank(current)
			seen.add(connected.id)
			reserved.append(connected)

def main() -> None:
	with open(0) as f:
		(N, M) = map(int, f.readline().split())
		ab = [map(int, line.split()) for line in f.readlines()]
	islands: Islands = Islands(N)
	for (a, b) in ab:
		islands[a].addConnection(islands[b])
	bfs(islands[1], 2)
	print('POSSIBLE' if islands[N].rank in (1, 2) else 'IMPOSSIBLE')

def __starting_point():
	main()
__starting_point()


(n, m) = map(int, input().split())
ab = [list(map(int, input().split())) for i in range(m)]
l = [[] for i in range(n)]
ab.sort()
for i in range(m):
	x = ab[i]
	l[x[0] - 1].append(x[1] - 1)
	l[x[1] - 1].append(x[0] - 1)
for i in l[0]:
	if n - 1 in l[i]:
		print('POSSIBLE')
		return
print('IMPOSSIBLE')


(N, M) = map(int, input().strip().split())
dp = [0 for _ in range(N)]
find = False
for _ in range(M):
	(a, b) = map(int, input().strip().split())
	if a == 1:
		dp[b - 1] += 1
	elif a == N:
		dp[b - 1] += 1
	if b == 1:
		dp[a - 1] += 1
	elif b == N:
		dp[a - 1] += 1
	if dp[a - 1] == 2 or dp[b - 1] == 2:
		find = True
		break
print('POSSIBLE' if find == True else 'IMPOSSIBLE')


(N, M) = map(int, input().split())
A = set()
B = set()
for _ in range(M):
	(a, b) = map(int, input().split())
	if a == 1:
		A.add(b)
	if b == N:
		B.add(a)
if len(A & B):
	print('POSSIBLE')
else:
	print('IMPOSSIBLE')


from collections import deque
(n, m) = map(int, input().split())
E = [[] for _ in range(n)]
for i in range(m):
	(a, b) = map(int, input().split())
	E[a - 1].append(b - 1)
	E[b - 1].append(a - 1)
dis = [200000 for i in range(n)]
dis[0] = 0
Q = deque([0])
while Q:
	now = deque.popleft(Q)
	for i in E[now]:
		if dis[i] == 200000:
			dis[i] = dis[now] + 1
			deque.append(Q, i)
print('POSSIBLE' if dis[-1] == 2 else 'IMPOSSIBLE')


(N, M) = map(int, input().split())
first = list()
second = set()
for i in range(M):
	(a, b) = map(int, input().split())
	if a == 1:
		first.append(b)
	if b == N:
		second.add(a)
for a in first:
	if a in second:
		print('POSSIBLE')
		break
else:
	print('IMPOSSIBLE')


(n, m) = map(int, input().split())
n -= 1
x = [[] for _ in range(200000)]
for _ in range(m):
	(a, b) = map(int, input().split())
	a -= 1
	b -= 1
	x[a].append(b)
cnt = 0
for i in x[0]:
	if n in x[i]:
		print('POSSIBLE')
		return
print('IMPOSSIBLE')


from collections import defaultdict
(N, M) = [int(x) for x in input().split()]
dict = defaultdict(bool)
for i in range(M):
	(a, b) = [int(x) for x in input().split()]
	dict[a, b] = True
for j in range(1, N + 1):
	if dict[1, j] and dict[j, N]:
		print('POSSIBLE')
		break
else:
	print('IMPOSSIBLE')


(n, m) = list(map(int, input().split()))
s1 = {}
sn = []
for i in range(m):
	(a, b) = list(map(int, input().split()))
	if a == 1:
		s1[b] = 1
	elif b == n:
		sn.append(a)
res = False
for s in sn:
	if s in s1:
		res = True
		break
print('POSSIBLE' if res else 'IMPOSSIBLE')


(n, m) = map(int, input().split())
d = [[] for i in range(n)]
for i in range(m):
	(a, b) = map(int, input().split())
	if a == 1 or b == 1 or a == n or (b == n):
		d[a - 1].append(b)
		d[b - 1].append(a)
for i in d[n - 1]:
	if 1 in d[i - 1]:
		print('POSSIBLE')
		return
print('IMPOSSIBLE')


from collections import deque
INF = 10 ** 20
(N, M) = map(int, input().split())
G = [[] for _ in range(N + 1)]
for i in range(M):
	(a, b) = map(int, input().split())
	G[a].append(b)
	G[b].append(a)

def bfs(s):
	seen = [0 for i in range(N + 1)]
	d = [0 for i in range(N + 1)]
	todo = deque()
	seen[s] = 1
	todo.append(s)
	while 1:
		if len(todo) == 0:
			break
		a = todo.popleft()
		if d[a] >= 2:
			continue
		for b in G[a]:
			if seen[b] == 0:
				seen[b] = 1
				todo.append(b)
				d[b] += d[a] + 1
	return d
d = bfs(1)
if d[N] != 0 and d[N] <= 2:
	print('POSSIBLE')
else:
	print('IMPOSSIBLE')


(n, m) = list(map(int, input().split()))
ab = [list(map(int, input().split())) for i in range(m)]
ren = []
for i in range(m):
	if ab[i][0] == 1:
		ren.append(ab[i][1])
	elif ab[i][1] == n:
		ren.append(ab[i][0])
ren.sort()
if ren[0] == 1 and ren[-1] == n:
	print('POSSIBLE')
else:
	for i in range(len(ren) - 1):
		if ren[i] == ren[i + 1]:
			print('POSSIBLE')
			break
	else:
		print('IMPOSSIBLE')


(N, M) = list(map(int, input().split()))
A = [[] for _ in range(N + 1)]
for _ in range(M):
	(a, b) = list(map(int, input().split()))
	A[a].append(b)
ans = False
for i in A[1]:
	if i == N:
		ans = True
		break
	for j in A[i]:
		if j == N:
			ans = True
			break
print('POSSIBLE' if ans else 'IMPOSSIBLE')


(n, m) = map(int, input().split())
data = [0] * n
for i in range(m):
	(a, b) = map(int, input().split())
	if a == 1:
		data[b - 1] += 1
		if data[b - 1] == 2:
			print('POSSIBLE')
			return
	if b == n:
		data[a - 1] += 1
		if data[a - 1] == 2:
			print('POSSIBLE')
			return
print('IMPOSSIBLE')


from _collections import deque
(n, m) = list(map(int, input().split()))
edg = [[] for i in range(n + 1)]
for i in range(m):
	(a, b) = list(map(int, input().split()))
	edg[a].append(b)
	edg[b].append(a)
dep = [-1] * (n + 1)
dep[1] = 0
data = deque([1])
while len(data) > 0:
	p = data.popleft()
	for i in edg[p]:
		if dep[i] == -1:
			dep[i] = dep[p] + 1
			data.append(i)
print('POSSIBLE' if dep[n] == 2 else 'IMPOSSIBLE')


(n, m) = [int(i) for i in input().split()]
hyou = []
for i in range(m):
	hyou.append([int(i) for i in input().split()])
next_island = set()
pre_island = set()
for go in hyou:
	(one, two) = go
	newone = min(one, two)
	newtwo = max(one, two)
	if newone == 1:
		next_island.add(newtwo)
	if newtwo == n:
		pre_island.add(newone)
ans = next_island & pre_island
if len(ans) == 0:
	print('IMPOSSIBLE')
else:
	print('POSSIBLE')


def main():
	import sys
	input = sys.stdin.readline
	(n, m) = list(map(int, input().split()))
	first = list()
	second = list()
	for i in range(m):
		(ai, bi) = list(map(int, input().split()))
		if ai == 1:
			first.append(bi)
		if bi == n:
			second.append(ai)
	ans = set(first) & set(second)
	if len(ans) > 0:
		print('POSSIBLE')
	else:
		print('IMPOSSIBLE')

def __starting_point():
	main()
__starting_point()


(n, m) = map(int, input().split())
x = [0] * n
s = 0
for i in range(m):
	(a, b) = map(int, input().split())
	if a == 1:
		if x[b - 1] == 0:
			x[b - 1] = 1
		elif x[b - 1] == -1:
			s += 1
	elif b == n:
		if x[a - 1] == 0:
			x[a - 1] = -1
		elif x[a - 1] == 1:
			s += 1
if s > 0:
	print('POSSIBLE')
else:
	print('IMPOSSIBLE')


(N, M) = map(int, input().split())
AB = [tuple(map(int, input().split())) for i in range(M)]
s1 = set()
sn = set()
for (a, b) in AB:
	if a == 1:
		s1.add(b)
	if b == N:
		sn.add(a)
print('POSSIBLE' if s1 & sn else 'IMPOSSIBLE')


(n, m) = list(map(int, input().split()))
e = [list() for _ in range(n)]
for i in range(m):
	(a, b) = list(map(int, input().split()))
	e[a - 1].append(b - 1)
	e[b - 1].append(a - 1)
visited = [float('inf')] * n
visited[0] = 0
from collections import deque
queue = deque()
queue.append([0, 0])
while queue:
	(v, d) = queue.popleft()
	for k in e[v]:
		if visited[k] == float('inf'):
			visited[k] = d + 1
			queue.append([k, d + 1])
if visited[n - 1] <= 2:
	print('POSSIBLE')
else:
	print('IMPOSSIBLE')


(N, M) = map(int, input().split())
ab = [list(map(int, input().split())) for _ in range(M)]
dic = {}
for (a, b) in ab:
	if a in dic.keys():
		dic[a].append(b)
	else:
		dic[a] = [b]
check = False
for i in dic[1]:
	if i in dic.keys():
		for j in dic[i]:
			if j == N:
				check = True
print('POSSIBLE' if check else 'IMPOSSIBLE')


L = list()
R = list()
(N, M) = map(int, input().split())
for i in range(M):
	(a, b) = map(int, input().split())
	if a == 1:
		L.append(b)
	elif b == 1:
		L.append(a)
	if a == N:
		R.append(b)
	elif b == N:
		R.append(a)
L = set(L)
R = set(R)
if len(L & R) == 0:
	print('IMPOSSIBLE')
else:
	print('POSSIBLE')


import sys
readline = sys.stdin.readline
(N, M) = map(int, readline().split())
G = [[] for i in range(N)]
for i in range(M):
	(a, b) = map(int, readline().split())
	G[a - 1].append(b - 1)
	G[b - 1].append(a - 1)
for child in G[0]:
	for gchild in G[child]:
		if gchild == N - 1:
			print('POSSIBLE')
			return
print('IMPOSSIBLE')


(n, m) = list(map(int, input().split()))
a = [0] * m
b = [0] * m
for i in range(m):
	(a[i], b[i]) = list(map(int, input().split()))
start = []
leave = []
for i in range(m):
	if a[i] == 1:
		start.append(b[i])
	elif b[i] == n:
		leave.append(a[i])
if set(start) & set(leave):
	print('POSSIBLE')
else:
	print('IMPOSSIBLE')


(N, M) = map(int, input().split())
N_List = []
O_List = []
for i in range(M):
	(a, b) = map(int, input().split())
	if a == 1:
		N_List.append(b)
	if b == 1:
		N_List.append(a)
	if a == N:
		O_List.append(b)
	if b == N:
		O_List.append(a)
print(('IMPOSSIBLE', 'POSSIBLE')[len(set(N_List) & set(O_List)) > 0])


(n, m) = map(int, input().split())
s = [False] * n
t = [False] * n
for i in range(m):
	(a, b) = map(int, input().split())
	if a == 1:
		s[b - 1] = True
	if b == n:
		t[a - 1] = True
for i in range(n):
	if s[i] == True and t[i] == True:
		print('POSSIBLE')
		return
print('IMPOSSIBLE')


import collections
(n, m) = list(map(int, input().split()))
visited = [False] * n
ships = [set() for i in range(n)]
for i in range(m):
	(a, b) = list(map(int, input().split()))
	ships[a - 1].add(b - 1)
	ships[b - 1].add(a - 1)
for i in range(1, n - 1):
	if 0 in ships[i] and n - 1 in ships[i]:
		print('POSSIBLE')
		return
print('IMPOSSIBLE')


(n, m) = map(int, input().split())
ans1 = []
ans2 = []
for _ in range(m):
	(a, b) = map(int, input().split())
	if a == 1:
		ans1.append(b)
	if b == n:
		ans2.append(a)
ans = set(ans1) & set(ans2)
if len(ans) > 0:
	print('POSSIBLE')
else:
	print('IMPOSSIBLE')


def main():
	(n, m) = list(map(int, input().split()))
	ab = [list(map(int, input().split())) for i in range(m)]
	ans = 'IMPOSSIBLE'
	list_1 = []
	list_n = []
	for i in range(m):
		if ab[i][0] == 1:
			list_1.append(ab[i][1])
		elif ab[i][1] == n:
			list_n.append(ab[i][0])
	if len(set(list_1) & set(list_n)) > 0:
		ans = 'POSSIBLE'
	print(ans)

def __starting_point():
	main()
__starting_point()


import sys
(n, m) = list(map(int, input().split()))
l = [[] for i in range(n)]
for i in range(m):
	(a, b) = list(map(int, input().split()))
	l[a - 1].append(b)
for i in l[0]:
	for j in l[i - 1]:
		if j == n:
			print('POSSIBLE')
			return
print('IMPOSSIBLE')


(n, m) = map(int, input().split())
b1 = []
b2 = []
for i in range(m):
	(a, b) = map(int, input().split())
	if a == 1:
		b1.append(b)
	if b == n:
		b2.append(a)
if len(b1) + len(b2) == len(list(set(b1 + b2))):
	print('IMPOSSIBLE')
else:
	print('POSSIBLE')


(n, m) = list(map(int, input().split()))
graph = dict()
for i in range(m):
	(a, b) = list(map(int, input().split()))
	if graph.get(a, -1) == -1:
		graph[a] = [b]
	else:
		graph[a].append(b)
	if graph.get(b, -1) == -1:
		graph[b] = [a]
	else:
		graph[b].append(a)
q = []
q.append((1, 0))
visited = dict()
visited[1] = 1
ans = 'IMPOSSIBLE'
while len(q) != 0:
	(front, d) = q[0]
	q.pop(0)
	if d > 2:
		break
	if front == n:
		ans = 'POSSIBLE'
		break
	lst = graph.get(front, 0)
	if lst == 0:
		continue
	else:
		for i in lst:
			if visited.get(i, -1) == -1:
				q.append((i, d + 1))
print(ans)


(n, m) = map(int, input().split())
start = [0] * 200001
goal = [0] * 200001
for i in range(m):
	(a, b) = map(int, input().split())
	if a == 1:
		if goal[b] == 1:
			print('POSSIBLE')
			return
		start[b] = 1
		a
	elif b == n:
		if start[a] == 1:
			print('POSSIBLE')
			return
		goal[a] = 1
print('IMPOSSIBLE')