CodeEff/ECCO huggingface dataset:
# Original solution
from collections import deque
N, M = map(int, input().split())
lst = [[] for _ in range(N + 1)]
dist = [float("inf")]*(N+1)
for _ in range(M):
    a, b = map(int, input().split())
    lst[a].append(b)
    lst[b].append(a)

q = deque()
d = 0
q.append([1,d])

while q:
    now, d = q.popleft()
    dist[now] = d

    for itm in lst[now]:
        if dist[itm] > d+1:
            q.append([itm,d+1])
            
print("POSSIBLE") if dist[N] <= 2 else print("IMPOSSIBLE")


# Optimized solution
from collections import deque
N, M = map(int, input().split())
lst = [[] for _ in range(N + 1)]
dist = [float("inf")]*(N+1)
dist[1] = 0
for _ in range(M):
    a, b = map(int, input().split())
    lst[a].append(b)
    lst[b].append(a)

q = deque()
q.append(1)

while q:
    now = q.popleft()

    for itm in lst[now]:
        if dist[itm] > dist[now]:
            q.append(itm)
            dist[itm] = dist[now] + 1
print("POSSIBLE") if dist[N] <= 2 else print("IMPOSSIBLE")
# Original solution
n, m = list(map(int, input().split()))
ikeru = [[] for _ in range(n)]
for i in range(m):
	a, b = list(map(int, input().split()))
	ikeru[a-1].append(b-1)
	ikeru[b-1].append(a-1)

fukasa = [10**18 for _ in range(n)]
kaisuu = 0
settansaku = set([])
listmada = [0]
setmada = set([0])

while len(setmada) != 0:
	kaisuu += 1
	for i in listmada[:]:
		settansaku.add(i)
		listmada.remove(i)
		setmada.remove(i)
		for k in ikeru[i]:
			if not k in setmada:
				if not k in settansaku:
					listmada.append(k)
					setmada.add(k)
					fukasa[k] = kaisuu

if fukasa[n-1] <= 2:
	print("POSSIBLE")
else:
	print("IMPOSSIBLE")

# Optimized solution
n, m = list(map(int, input().split()))
ikeru = [[] for _ in range(n)]
for i in range(m):
	a, b = list(map(int, input().split()))
	ikeru[a-1].append(b-1)
	ikeru[b-1].append(a-1)

fukasa = [10**18 for _ in range(n)]
kaisuu = 0
settansaku = set([])
setmada = set([0])

while len(setmada) != 0:
	kaisuu += 1
	for i in list(setmada):
		settansaku.add(i)
		setmada.remove(i)
		for k in ikeru[i]:
			if not k in setmada:
				if not k in settansaku:
					setmada.add(k)
					fukasa[k] = kaisuu

if fukasa[n-1] <= 2:
	print("POSSIBLE")
else:
	print("IMPOSSIBLE")
# Original solution
n, m = list(map(int, input().split()))
ab = [list(map(int, input().split())) for _ in range(m)]

ab1 = []
ab2 = []

for i in ab:
    if i[0] == 1:
        ab1.append(i[1])
    elif i[1] == n:
        ab2.append(i[0])

for i in ab1:
    for j in ab2:
        if i == j:
            print("POSSIBLE")
            exit()

print("IMPOSSIBLE")

# Optimized solution
n, m = list(map(int, input().split()))
ab = [list(map(int, input().split())) for _ in range(m)]

ab1 = []
ab2 = []

for i in ab:
    if i[0] == 1:
        ab1.append(i[1])
    elif i[1] == n:
        ab2.append(i[0])

jud = ab1 + ab2
if len(jud) == len(set(jud)):
    print("IMPOSSIBLE")
else:
    print("POSSIBLE")
# Original solution
n,m = (int(i) for i in input().split())
x = [[int(i) for i in input().split()] for i in range(m)]
x.sort()
a = []
for i in x:
	if i[0]==1:
		a.append(i[1])
	else:
		break
for j in a:
	if [j,n] in x:
		m = 0
		print("POSSIBLE")
		break
if m != 0:
	print("IMPOSSIBLE")

# Optimized solution
n,m = (int(i) for i in input().split())
x = [[int(i) for i in input().split()] for i in range(m)]
a ,b= [],[]
for i in x:
	if i[0]==1:
		a.append(i[1])
	if i[1]==n:
		b.append(i[0])
if len(a)+len(b) == len(set(a+b)): print("IMPOSSIBLE")
else: print("POSSIBLE")
# Original solution
# coding: utf-8
from queue import Queue

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)

def is_reach(n):
    dist = [0 for i in range(N+1)]
    is_visit = [False for i in range(N+1)]
    is_visit[1] = True
    q = Queue()
    q.put(1)
    while not q.empty():
        v = q.get()
        for u in graph[v]:
            if not is_visit[u]:
                is_visit[u] = True
                q.put(u)
                dist[u] = dist[v] + 1
                if u == n and dist[u] == 2:
                    return True
                if dist[u] > 2:
                    return False
    return False

print(("POSSIBLE" if is_reach(N) else "IMPOSSIBLE"))


# Optimized solution
# 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)
# Original solution
# /usr/bin/python
# -*- coding: utf-8 -*-
import math



def main():
  N,M = list(map(int, input().split()))
  route1 = []
  routeN = []
  for _ in range(M):
    ab = sorted(list(map(int, input().split())))
    if ab[0] == 1:
      route1.append(ab[1])
    elif ab[1] == N:
      routeN.append(ab[0])

  for i in route1:
    if i in routeN:
      return True
  return False

if __name__ == "__main__":
  if main():
    print('POSSIBLE')
  else:
    print('IMPOSSIBLE')

# Optimized solution
# /usr/bin/python
# -*- coding: utf-8 -*-
import math



def main():
  N,M = list(map(int, input().split()))
  route = [0 for _ in range(N+1)]

  for _ in range(M):
    a,b = list(map(int, input().split()))
    if a == 1:
      route[b] += 1
    elif b == N:
      route[a] += 1

  if max(route) >= 2:
    return True
  else:
    return False


if __name__ == "__main__":
  if main():
    print('POSSIBLE')
  else:
    print('IMPOSSIBLE')
# Original solution
N,M = list(map(int,input().split()))
K=[]
A=[]
B=[]
answer='IMPOSSIBLE'
for i in range(M):
  a,b=list(map(int,input().split()))
  if a==1:
    A +=[b]
  if b==N:
    B += [a]
for x in B:
  if x in A:
    answer='POSSIBLE'
print(answer)

# Optimized solution
N,M = list(map(int,input().split()))
K=[0]*(N+1)
for i in range(M):
  a,b=list(map(int,input().split()))
  if a==1:
    K[b] +=1
  if b == N:
    K[a] +=1
print(('POSSIBLE' if 2 in K else 'IMPOSSIBLE'))
# Original solution
n, m = list(map(int, input().split()))
a = []
b = []
for i in range(m):
    a_, b_ = list(map(int, input().split()))
    if a_ == 1 or a_ == n or b_ == 1 or b_ == n:
        a.append(a_)
        b.append(b_)

for i in range(len(a)):
    if a[i] == 1 or b[i] == 1:
        x = max(a[i], b[i])
        for j in range(len(a)):
            if a[j] == x or b[j] == x:
                if max(a[j], b[j]) == n:
                    print("POSSIBLE")
                    exit()
print("IMPOSSIBLE")


# Optimized solution
n, m = list(map(int, input().split()))
a = []
b = []
for i in range(m):
    a_, b_ = list(map(int, input().split()))
    if a_ == 1 or a_ == n or b_ == 1 or b_ == n:
        a.append(a_)
        b.append(b_)

x_min=[]
x_max=[]
for i in range(len(a)):
    if a[i] == 1 or b[i] == 1:
        x_max.append(max(a[i], b[i]))
    if a[i] == n or b[i] == n:
        x_min.append(min(a[i], b[i]))
x = x_min + x_max
if len(x) == len(set(x)):
    print("IMPOSSIBLE")
else:
    print("POSSIBLE")
# Original solution
n, m = list(map(int, input().split()))
Ton = []
Fr1 = []
for i in range(m):
    a, b = list(map(int, input().split()))
    if b==n:
        Ton.append(a)
    if a==1:
        Fr1.append(b)

r = 'IMPOSSIBLE'
for a in Fr1:
    if a in Ton:
        r = 'POSSIBLE'
print(r)

# Optimized solution
def main():
    n, m = list(map(int, input().split()))
    Ton, Fr1 = set(), set()
    for _ in range(m):
        a, b = list(map(int, input().split()))
        if b==n:
            Ton.add(a)
        if a==1:
            Fr1.add(b)

    print(('POSSIBLE' if Ton&Fr1 else 'IMPOSSIBLE'))

main()
# Original solution
def slove():
    import sys
    import collections
    input = sys.stdin.readline
    n, m = list(map(int, input().rstrip('\n').split()))
    s = collections.defaultdict(list)
    e = collections.defaultdict(list)
    for i in range(m):
        a, b = list(map(int, input().rstrip('\n').split()))
        if a == 1:
            s[b]
        if b == 1:
            s[a]
        if a == n:
            e[b]
        if b == n:
            e[a]
    for v in list(s.keys()):
        if v in e:
            print("POSSIBLE")
            exit()
    print("IMPOSSIBLE")



if __name__ == '__main__':
    slove()


# Optimized solution
import sys
import collections


def solve():
    sys.setrecursionlimit(2000)
    input = sys.stdin.readline
    mod = 10 ** 9 + 7
    n, m = list(map(int, input().rstrip('\n').split()))
    d = collections.defaultdict(list)
    for i in range(m):
        a, b = list(map(int, input().rstrip('\n').split()))
        if a == 1:
            d[b] += [1]
        if b == 1:
            d[a] += [1]
        if a == n:
            d[b] += [n]
        if b == n:
            d[a] += [n]
    for k, v in list(d.items()):
        if len(v) == 2:
            print("POSSIBLE")
            exit()
    print("IMPOSSIBLE")


if __name__ == '__main__':
    solve()
# Original solution
import sys
import collections


def solve():
    sys.setrecursionlimit(2000)
    input = sys.stdin.readline
    mod = 10 ** 9 + 7
    n, m = list(map(int, input().rstrip('\n').split()))
    d = collections.defaultdict(list)
    for i in range(m):
        a, b = list(map(int, input().rstrip('\n').split()))
        if a == 1:
            d[b] += [1]
        if b == 1:
            d[a] += [1]
        if a == n:
            d[b] += [n]
        if b == n:
            d[a] += [n]
    for k, v in list(d.items()):
        if len(v) == 2:
            print("POSSIBLE")
            exit()
    print("IMPOSSIBLE")


if __name__ == '__main__':
    solve()


# Optimized solution
import sys
import collections


def solve():
    readline = sys.stdin.buffer.readline
    mod = 10 ** 9 + 7
    n, m = list(map(int, readline().split()))
    d = collections.defaultdict(list)
    for _ in range(m):
        a, b = list(map(int, readline().split()))
        if a == 1 or a == n:
            if a not in d[b]:
                d[b] += [a]
        elif b == 1 or b == n:
            if b not in d[a]:
                d[a] += [b]
    for k, v in list(d.items()):
        if k != 1 and k != n:
            if len(v) == 2:
                print("POSSIBLE")
                exit()
    print("IMPOSSIBLE")


if __name__ == '__main__':
    solve()
# Original solution
def main():
    n, m = list(map(int, input().split()))
    root_start = []
    root_goal = []
    for i in range(m):
        li = list(map(int, input().split()))
        if li[0] == 1:
            root_start.append(li[1])
        elif li[1] == n:
            root_goal.append(li[0])
    flg = False
    for ls in root_start:
        if ls in root_goal:
            flg = True

    print('POSSIBLE') if flg else print('IMPOSSIBLE')



if __name__ == '__main__':
    main()


# Optimized solution
def main():
    n, m = list(map(int, input().split()))
    root_start = []
    root_goal = []
    ans = {}
    for i in range(m):
        li = list(map(int, input().split()))
        if li[0] == 1:
            ans.setdefault(li[1], 0)
            ans[li[1]] += 1
        elif li[1] == n:
            ans.setdefault(li[0], 0)
            ans[li[0]] += 1
    flg = False
    for k in ans:
        if ans[k] >= 2:
            flg = True

    print('POSSIBLE') if flg else print('IMPOSSIBLE')



if __name__ == '__main__':
    main()
# Original solution
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 = []
clear = 0

for i in range(M):
    if b[i] == N:
        c.append(a[i])

for i in range(M):
    if a[i] == 1 and b[i] in c:
        clear = 1
        break

if clear == 1:
    print('POSSIBLE')
else:
    print('IMPOSSIBLE')




# Optimized solution
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')
# Original solution
N,M = list(map(int,input().split()))
x = 1
y = 1

for m in range(M):
    a,b = list(map(int,input().split()))
    if a==1:
      x|=1<<b
    if b==N:
      y|=1<<a

print(("IM"*(x&y==1)+"POSSIBLE"))

# Optimized solution
N,M = list(map(int,input().split()))
x = set()
y = set()

for m in range(M):
    a,b = list(map(int,input().split()))
    if a==1:
      x.add(b)
    if b==N:
      y.add(a)

if x&y:
  print("POSSIBLE")
else:
  print("IMPOSSIBLE")
# Original solution
N,M = list(map(int,input().split()))
S = [list(map(int,input().split())) for m in range(M)]
T = [s for s in S if 1 in s or N in s]
ans = "IMPOSSIBLE"

for n in range(1+N):
  if [1,n] in T and [n,N] in T:
    ans = "POSSIBLE"

print(ans)

# Optimized solution
N,M = list(map(int,input().split()))
x = set()
y = set()

for m in range(M):
  a,b = list(map(int,input().split()))
  if a==1:
    x.add(b)
  if b==N:
    y.add(a)

if x&y:
  print("POSSIBLE")
else:
  print("IMPOSSIBLE")
# Original solution
N,M = list(map(int, input().split()))
mem = [[] for i in range(N)]

p1 = []
p2 = []
def solve():
    for i in range(M):
        a,b = list(map(int, input().split()))
        if a == 1:
            p1.append(b)
        elif b == N:
            p2.append(a)
    for p in p1:
        if p in p2: return True
    return False

print(('POSSIBLE' if solve() else 'IMPOSSIBLE'))


# Optimized solution
N,M = list(map(int, input().split()))
mem = [[] for i in range(N)]

p1 = []
p2 = []
def solve():
    for i in range(M):
        a,b = list(map(int, input().split()))
        if a == 1:
            p1.append(b)
        elif b == N:
            p2.append(a)
    return len(set(p1) & set(p2)) > 0

print(('POSSIBLE' if solve() else 'IMPOSSIBLE'))
# Original solution
N, M = list(map(int, input().split()))
ab = [tuple(map(int, input().split())) for _ in range(M)]
one_to_other = set([b for a, b in ab if a == 1])
other_to_n = set([a for a, b in ab if b == N])

way = one_to_other & other_to_n
if len(way) >= 1:
    print("POSSIBLE")
else:
    print("IMPOSSIBLE")


# Optimized solution
N, M = list(map(int, input().split()))
first = set()
second = set()

for i in range(M):
  a, b = list(map(int, input().split()))
  if a == 1:
    first.add(b)
  if b == N:
    second.add(a)

if first & second:
  print("POSSIBLE")
else:
  print("IMPOSSIBLE")
# Original solution
# -*- coding: utf-8 -*-
"""
http://abc068.contest.atcoder.jp/tasks/arc079_a

"""

def solve(routes, N):
    result = 'IMPOSSIBLE'
    to_middle = set()           #  島1から渡ることのできる島
    from_middle = set()         #  島Nへ渡ることのできる島
    for f, t in routes:
        if f == 1:
            to_middle.add(t)
        elif t == N:
            from_middle.add(f)

    if to_middle & from_middle:
        result = 'POSSIBLE'
    return result



def main():
    N, M = list(map(int, input().split()))
    routes = []
    for _ in range(M):
        routes.append([int(x) for x in input().split()])
    result = solve(routes, N)
    print(result)


if __name__ == '__main__':
    main()

# Optimized solution
# -*- coding: utf-8 -*-
"""
http://abc068.contest.atcoder.jp/tasks/arc079_a
AC
"""

def solve(routes, N):
    result = 'IMPOSSIBLE'
    to_middle = set()           #  島1から渡ることのできる島
    from_middle = set()         #  島Nへ渡ることのできる島
    for f, t in routes:
        if f == 1:
            to_middle.add(t)
        elif t == N:
            from_middle.add(f)

    if to_middle & from_middle:
        result = 'POSSIBLE'
    return result



def main():
    N, M = list(map(int, input().split()))
    routes = []
    for _ in range(M):
        routes.append([int(x) for x in input().split()])
    result = solve(routes, N)
    print(result)


if __name__ == '__main__':
    # main()

    to_middle = set()           #  島1から渡ることのできる島
    from_middle = set()         #  島Nへ渡ることのできる島
    N, M = list(map(int, input().split()))
    for _ in range(M):
        f, t = list(map(int, input().split()))
        if f == 1:
            to_middle.add(t)
        elif t == N:
            from_middle.add(f)

    if to_middle & from_middle:
        print('POSSIBLE')
    else:
        print('IMPOSSIBLE')
# Original solution
to_middle = set()           #  島1から渡ることのできる島
from_middle = set()         #  島Nへ渡ることのできる島
N, M = list(map(int, (input().split())))
for _ in range(M):
    f, t = list(map(int, (input().split())))
    if f == 1:
        to_middle.add(t)
    elif t == N:
        from_middle.add(f)

if to_middle & from_middle:
    print('POSSIBLE')
else:
    print('IMPOSSIBLE')


# Optimized solution
from sys import stdin
input = stdin.readline

to_middle = set()           #  島1から渡ることのできる島
from_middle = set()         #  島Nへ渡ることのできる島
N, M = list(map(int, (input().split())))
for _ in range(M):
    f, t = list(map(int, (input().split())))
    if f == 1:
        to_middle.add(t)
    elif t == N:
        from_middle.add(f)

if to_middle & from_middle:
    print('POSSIBLE')
else:
    print('IMPOSSIBLE')
# Original solution
n,m = list(map(int,input().split()))
a_lst = []
for i in range(m):
  a_lst.append( list(map(int,input().split())) )

ans = "IMPOSSIBLE"

start_lst = []
goal_lst = []
for a in a_lst:
  if a[0] == 1:
    start_lst.append(a[1])
  if a[1] == n:
    goal_lst.append(a[0])
    
for s in start_lst:
  if s in goal_lst:
    ans = "POSSIBLE"
    
print(ans)

# Optimized solution
n,m = list(map(int,input().split()))

start_set = set()
goal_set = set()
for i in range(m):
  s,g = list(map(int,input().split()))
  if s == 1:
    start_set.add(g)
  if g == n:
    goal_set.add(s)    

ans = "POSSIBLE" if (start_set & goal_set) else "IMPOSSIBLE"
print(ans)
# Original solution
n, m = list(map(int, input().split()))

first = []
second = []
for i in range(m):
    a = list(map(int, input().split()))
    if a[0] == 1:
        first.append(a[1])
    if a[1] == n:
        second.append(a[0])


for i in first:
    if i in second:
        print('POSSIBLE')
        exit()

print('IMPOSSIBLE')

# Optimized solution
n, m = list(map(int, input().split()))

first = []
second = []
for i in range(m):
    a = list(map(int, input().split()))
    if a[0] == 1:
        first.append(a[1])
    if a[1] == n:
        second.append(a[0])


if len(set(first) & set(second)) > 0:
    print('POSSIBLE')
else:
    print('IMPOSSIBLE')
# Original solution
n, m = list(map(int, input().split()))
n -= 1

ab = [[] for i in range(n)]

for _ in range(m):
    a, b = list(map(int, input().split()))
    ab[a-1].append(b-1)

for i in ab[0]:
    for j in ab[i]:
        if j == n:
            print("POSSIBLE")
            exit()

print("IMPOSSIBLE")

# Optimized solution
n, m = list(map(int, input().split()))

x = [[] for _ in range(n)]
for _ in range(m):
    a, b = list(map(int, input().split()))
    x[a-1].append(b-1)

if x[0] == []:
    print("IMPOSSIBLE")
    exit()

for i in x[0]:
    for j in x[i]:
        if j == n-1:
            print("POSSIBLE")
            exit()

print("IMPOSSIBLE")
# Original solution
n, m = list(map(int, input().split()))

x = [[] for _ in range(n)]
for _ in range(m):
    a, b = list(map(int, input().split()))
    x[a-1].append(b-1)

if x[0] == []:
    print("IMPOSSIBLE")
    exit()

for i in x[0]:
    for j in x[i]:
        if j == n-1:
            print("POSSIBLE")
            exit()

print("IMPOSSIBLE")

# Optimized solution
n, m = list(map(int, input().split()))

x = [[] for _ in range(n)]
for _ in range(m):
    a, b = list(map(int, input().split()))
    x[a-1].append(b-1)

for i in x[0]:
    for j in x[i]:
        if j == n-1:
            print("POSSIBLE")
            exit()

print("IMPOSSIBLE")
# Original solution
n, m = list(map(int, input().split()))
AB = [tuple(map(int, input().split())) for _ in range(m)]
C = [b for a, b in AB if a == 1]
for a, b in AB:
  if a in C and b == n:
    print('POSSIBLE')
    exit()
print('IMPOSSIBLE')

# Optimized solution
n, m = list(map(int, input().split()))
AB = [tuple(map(int, input().split())) for _ in range(m)]

C, D = set(), set()
for a, b in AB:
  if a == 1:
    C.add(b)
  elif b == n:
    D.add(a)

if len(C & D):
  print('POSSIBLE')
else:
  print('IMPOSSIBLE')
# Original solution
island, ship = list(map(int, input().split()))
startTo, fromGoal = [], []
for i in range(ship):
  a, b = list(map(int, input().split()))
  if a == 1:
    startTo.append(b)
  elif b == 1:
    startTo.append(a)
  elif a == island:
    fromGoal.append(b)
  elif b == island:
    fromGoal.append(a)
check = False
if len(startTo) < len(fromGoal):
  for i in range(len(startTo)):
    check = startTo[i] in fromGoal
    if check:
      break
else:
  for i in range(len(fromGoal)):
    check = fromGoal[i] in startTo
    if check:
      break
if check:
  print("POSSIBLE")
else:
  print("IMPOSSIBLE")

# Optimized solution
island, ship = list(map(int, input().split()))
startTo, fromGoal = [False] * island, [False] * island
for i in range(ship):
  a, b = list(map(int, input().split()))
  if a == 1:
    startTo[b - 1] = True
  elif b == 1:
    startTo[a - 1] = True
  elif a == island:
    fromGoal[b - 1] = True
  elif b == island:
    fromGoal[a - 1] = True
check = False
for i in range(island):
  if startTo[i] and fromGoal[i]:
    check = True
    break
if check:
  print("POSSIBLE")
else:
  print("IMPOSSIBLE")
# Original solution
from collections import defaultdict

n,m=list(map(int,input().split()))
s=[tuple(map(int,input().split())) for _ in range(m)]
d=defaultdict(int)
for x in s:
  d[x[0]]|=(1<<x[1])
  d[x[1]]|=(1<<x[0])
if d[1]&d[n]>0:
  print('POSSIBLE')
else:
  print('IMPOSSIBLE')


# Optimized solution
import sys
from collections import defaultdict
from heapq import heapify, heappush
n,m=list(map(int,input().split()))
s=[tuple(map(int,input().split())) for _ in range(m)]
def hl():
  ret=[]
  heapify(ret)
  return ret
d=defaultdict(hl)
for x in s:
  heappush(d[x[0]],-x[1])
  heappush(d[x[1]],-x[0])
for e in d[1]:
  if d[-e][0]==-n:
    print('POSSIBLE')
    sys.exit()
print('IMPOSSIBLE')
# Original solution
n, m = list(map(int, input().split()))
s = {tuple(map(int, input().split())) for _ in range(m)}

for i in range(2, n):
    route = [1, i, n]
    if all(edge in s for edge in zip(route, route[1:])):
        print('POSSIBLE')
        break
else:
    print('IMPOSSIBLE')



# Optimized solution
n, m = list(map(int, input().split()))
transit_a = set()
transit_b = set()
for _ in range(m):
    a, b = list(map(int, input().split()))
    if a == 1:
        transit_b |= {b}
    elif b == n:
        transit_a |= {a}

print(('POSSIBLE' if len(transit_a & transit_b) else 'IMPOSSIBLE'))
# Original solution
n, m = list(map(int, input().split()))
transit_a = set()
transit_b = set()
for _ in range(m):
    a, b = list(map(int, input().split()))
    if a == 1:
        transit_b |= {b}
    elif b == n:
        transit_a |= {a}

print(('POSSIBLE' if len(transit_a & transit_b) else 'IMPOSSIBLE'))

# Optimized solution
n, m = list(map(int, input().split()))
transit_a = set()
transit_b = set()
for _ in range(m):
    a, b = list(map(int, input().split()))
    if a == 1:
        transit_b.add(b)
    elif b == n:
        transit_a.add(a)

print(('POSSIBLE' if len(transit_a & transit_b) else 'IMPOSSIBLE'))
# Original solution
N,M = list(map(int,input().split()))
I = set()
n = set()
for i in range(M):
    a,b = list(map(int,input().split()))
    if a == 1:
        I.add(b)
    if b == 1:
        I.add(a)
    if a == N:
        n.add(b)
    if b == N:
        n.add(a)
if  I & n == set():
    print("IMPOSSIBLE")
else:
    print("POSSIBLE")

# Optimized solution
N,M = list(map(int,input().split()))
I = set()
n = set()
for i in range(M):
    a,b = list(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")
# Original solution
n,m=list(map(int,input().split()))
A=[input().split() for _ in range(m)]
ans="IMPOSSIBLE"
for i in range(m):
  if A[i][0]=="1":
    if [A[i][1],str(n)] in A:
      ans="POSSIBLE"
      break
print(ans)

# Optimized solution
n,m=list(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)
print(("POSSIBLE" if A&B else "IMPOSSIBLE"))