CodeEff/ECCO huggingface dataset:
# Original solution
import sys
input=sys.stdin.readline
n,m=list(map(int,input().split()))
tr=[[] for i in range(n+1)]
for i in range(m):
  a,b=list(map(int,input().split()))
  if a!=1 and b!=n:
    continue
  tr[a].append(b)
  tr[b].append(a)
for i in range(2,n):
  if len(tr[i])==2:
    print("POSSIBLE")
    break
else:
  print("IMPOSSIBLE")


# Optimized solution
import sys
input=sys.stdin.readline
n,m=list(map(int,input().split()))
tr=[[] for i in range(n+1)]
for i in range(m):
  a,b=list(map(int,input().split()))
  if a!=1 and b!=n:
    continue
  if a==1:
    if tr[b]==[n]:
      print("POSSIBLE")
      exit()
    else:
      tr[b].append(a)
  if b==n:
    if tr[a]==[1]:
      print("POSSIBLE")
      exit()
    else:
      tr[a].append(b)
else:
  print("IMPOSSIBLE")
# Original solution
n,m=list(map(int,input().split()))
flag=False
one = []
enu = []
for i in range(m):
  a,b=list(map(int,input().split()))
  if a==1:
    one.append(b)
  elif b==n:
    enu.append(a)

for i in one:
  if i in enu:
    flag=True
    break

if flag: print('POSSIBLE')
else: print('IMPOSSIBLE')

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

if len(set(li))==len(li): print('IMPOSSIBLE')
else: print('POSSIBLE')
# Original solution
n,m=list(map(int,input().split(" ")))
l=[]
bone=[]
ans="IMPOSSIBLE"
for i in range(m):
		a,b=input().split(" ")
		if a=="1":l.append(b)
		if b==str(n):bone.append(a)

		
def cat_snuke():
	for i in l:
		for j in bone:
			if i == j:
				print("POSSIBLE")
				return 0
	print("IMPOSSIBLE")
	
cat_snuke()

# Optimized solution
n,m=list(map(int,input().split(" ")))
l=[]
bone=[]
for i in range(m):
		a,b=input().split(" ")
		if a=="1":l.append(b)
		if b==str(n):bone.append(a)

ans=list(set(l) & set(bone))
if len(ans)!=0:
	print("POSSIBLE")
else:			
	print("IMPOSSIBLE")
# Original solution
N, M = list(map(int, input().split()))
teiki_1 = []
teiki_N = []
for _ in range(M):
    a, b = list(map(int, input().split()))
    if a == 1 or b == 1:
        teiki_1.append(a if a != 1 else b)
    if a == N or b == N:
        teiki_N.append(a if a != N else b)
for num in sorted(teiki_1):
    if num in sorted(teiki_N):
        print('POSSIBLE')
        exit()
print('IMPOSSIBLE')


# Optimized solution
N, M = list(map(int, input().split()))
teiki_1 = []
teiki_N = []
for _ in range(M):
    a, b = list(map(int, input().split()))
    if a == 1 or b == 1:
        teiki_1.append(a if a != 1 else b)
    if a == N or b == N:
        teiki_N.append(a if a != N else b)
if len(set(teiki_1) & set(teiki_N)) > 0:
    print('POSSIBLE')
else:
    print('IMPOSSIBLE')
# Original solution
# 2019/08/05

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


for e in edge[-1]:
    if 0 in edge[e]:
        print('POSSIBLE')
        exit()

print('IMPOSSIBLE')

# Optimized solution
# 2019/08/05

input=open(0).readline

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


for e in edge[-1]:
    if 0 in edge[e]:
        print('POSSIBLE')
        exit()

print('IMPOSSIBLE')
# Original solution
n, m = list(map(int, input().split()))
ab_list = [0] * m
for i in range(m):
	ab_list[i] = list(map(int, input().split()))
a_list = []
b_list = []
for i in ab_list:
	if i[0] == 1:
		a_list.append(i[1])
	elif i[1] == n:
		b_list.append(i[0])
r = 'IMPOSSIBLE'
for a in a_list:
	if a in b_list:
		r = 'POSSIBLE'
		break
print(r)

# Optimized solution
n, m = list(map(int, input().split()))
ab_list = [0] * m
for i in range(m):
	ab_list[i] = list(map(int, input().split()))
a_list = []
b_list = []
for i in ab_list:
	if i[0] == 1:
		a_list.append(i[1])
	elif i[1] == n:
		b_list.append(i[0])
r = 'POSSIBLE' if set(a_list) & set(b_list) else 'IMPOSSIBLE'
print(r)
# Original solution
n,m = list(map(int,input().split()))
matrix = [[] for i in range(n)]
for i in range(m):
    a,b = list(map(int,input().split()))
    a -= 1
    b -= 1
    matrix[a].append(b)
    matrix[b].append(a)
for i in matrix[0]:
    if i in matrix[n-1]:
        print('POSSIBLE')
        exit()
print('IMPOSSIBLE')

# Optimized solution
n,m = list(map(int,input().split()))
Check1 = [False]*n
Check2 = [False]*n
for i in range(m):
    a,b = list(map(int,input().split()))
    if a ==1:
        Check1[b-1] = True
    elif a == n:
        Check2[b-1] = True
    elif b == 1:
        Check1[a-1] = True
    elif b == n:
        Check2[a-1] = True
for i in range(n):
    if Check1[i] and Check2[i]:
        print('POSSIBLE')
        exit()
print('IMPOSSIBLE')
# Original solution
N,M = list(map(int, input().split()))
A = [[] for i in range(N)]
for i in range(M):
    a,b = list(map(int, input().split()))
    a -= 1
    b -= 1
    A[a].append(b)
    A[b].append(a)

for j in A[0]:
    if j in A[-1]:
        print("POSSIBLE")
        break
else:
    print('IMPOSSIBLE')

# Optimized solution
N,M = list(map(int, input().split()))
A = [[] for i in range(N)]
for i in range(M):
    a,b = list(map(int, input().split()))
    a -= 1
    b -= 1
    A[a].append(b)
    A[b].append(a)

if len(A[0])+len(A[-1]) != len(set(A[0]+A[-1])):
        print("POSSIBLE")
else:
    print('IMPOSSIBLE')
# Original solution
n,m=list(map(int,input().split()))
lst=[]
for i in range(m):
    lst.append(list(map(int,input().split())))

ipponme=[]

for i in lst:
    if i[0]==1:
        ipponme.append(i[1])

for i in ipponme:
    for j in lst:
        if j[0]==i and j[1]==n:
            print("POSSIBLE")
            exit()
print("IMPOSSIBLE")

# Optimized solution
n,m=list(map(int,input().split()))
lst=[]
for i in range(m):
    lst.append(list(map(int,input().split())))

front=[]
back=[]

for i in lst:
    if i[0]==1:
        front.append(i[1])

for i in lst:
    if i[1]==n:
        back.append(i[0])
front=set(front)
back=set(back)
print(("POSSIBLE" if len(front&back)>=1 else "IMPOSSIBLE"))
# Original solution
from collections import deque 


N, M = list(map(int, input().split()))
to = [[] for _ in range(N)]
for _ in range(M):
    a, b = list(map(int, input().split()))
    a, b = a - 1, b - 1
    to[a].append(b)
    to[b].append(a)
    
que = deque()
que.append(0)
dist = [-1] * N
dist[0] = 0

while que:
    island = que.popleft()
    for nxt in to[island]:
        if dist[nxt] != -1:
            continue
        que.append(nxt)
        dist[nxt] = dist[island] + 1
        
print(('POSSIBLE' if dist[N - 1] == 2 else 'IMPOSSIBLE'))

# Optimized solution
N, M = list(map(int, input().split()))
to = [[] for _ in range(N)]
ans = 'IMPOSSIBLE'

for _ in range(M):
    a, b = list(map(int, input().split()))
    a, b = a - 1, b - 1
    to[a].append(b)
    to[b].append(a)
    
for nxt in to[0]:
    if N - 1 in to[nxt]:
        ans = 'POSSIBLE'
        break
        
print(ans)
# Original solution
n,m = list(map(int,input().split()))
if m == 1:
    print("IMPOSSIBLE")
    exit()
a = []
for i in range(m):
    arr = list(map(int,input().split()))
    if 1 in arr or n in arr:
        a.append(arr)
l = [i[0] for i in a if i[1]==n]
if len(l)==0:
    print("IMPOSSIBLE")
    exit()
for i in l:
    if [1,i] in a:
        print("POSSIBLE")
        exit()
print("IMPOSSIBLE")

# Optimized solution
n,m = list(map(int,input().split()))
if m == 1:
    print("IMPOSSIBLE")
    exit()
a = set()
b = set()
for i in range(m):
    arr = list(map(int,input().split()))
    if 1 in arr:a.add(arr[1])
    if n in arr:b.add(arr[0])
if len(a&b)==0:print("IMPOSSIBLE")
else:print("POSSIBLE")
# Original solution
N,M = list(map(int,input().split()))
L = [list(map(int,input().split())) for i in range(M)]
flag = False
j = 0
while (0 <= j <= len(L)-1):
  k = L[j][1]
  if ([1,k] in L):
    if ([k,N] in L):
      flag = True
      break
    else:
      j += 1
  else:
    j += 1
if flag:
  print('POSSIBLE')
else:
  print('IMPOSSIBLE')

# Optimized solution
N,M = list(map(int,input().split()))
L = [list(map(int,input().split())) for i in range(M)]
J = [False]*(N+1)
K = [False]*(N+1)
J[0] = False
K[N] = False
J[1] = False
K[1] = False
for j in range(M):
  if L[j][0] == 1:
    J[L[j][1]] = True
for k in range(M):
  if L[k][1] == N:
    K[L[k][0]] = True
flag = False
for l in range(N+1):
  if J[l] and K[l]:
    flag = True
    break
if flag:
  print('POSSIBLE')
else:
  print('IMPOSSIBLE')
# Original solution
N,M=list(map(int,input().split()))
from1=set()
toN=set()
for i in range(M):
  a,b=list(map(int,input().split()))
  if a==1:
    from1.add(b)
  elif b==N:
    toN.add(a)
print((("","IM")[len(from1&toN)==0]+"POSSIBLE"))
  

# Optimized solution
N,M=list(map(int,input().split()))
f=set()
t=set()
for i in range(M):
  a,b=list(map(int,input().split()))
  if a<2:
    f.add(b)
  elif b==N:
    t.add(a)
print((("IM","")[len(f&t)]+"POSSIBLE"))
# Original solution
N,M=list(map(int,input().split()))
f=set()
t=set()
for i in range(M):
  a,b=list(map(int,input().split()))
  if a<2:
    f.add(b)
  if b==N:
    t.add(a)
print(("IM"*(len(f&t)^1)+"POSSIBLE"))

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

N,M = list(map(int,readline().split()))
G = [[] for i in range(N)]

for i in range(M):
  a,b = list(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")
      exit(0)
print("IMPOSSIBLE")
# Original solution
import math,string,itertools,fractions,heapq,collections,re,array,bisect,sys,random,time

sys.setrecursionlimit(10**7)
inf=10**20
mod=10**9+7

def LI(): return list(map(int,input().split()))
def I(): return int(eval(input()))
def LS(): return input().split()
def S(): return eval(input())

def main():
  n,m=LI()
  
  l=[]
  for _ in range(m):
    a,b=LI()

    if a==1:
      l.append(b)
    elif a==n:
      l.append(b)
    elif b==n:
      l.append(a)

  if len(l)!=len(list(set(l))):
    return 'POSSIBLE'

  return 'IMPOSSIBLE'

print((main()))


# Optimized solution
import math,string,itertools,fractions,heapq,collections,re,array,bisect,sys,random,time

sys.setrecursionlimit(10**7)
inf=10**20
mod=10**9+7

def LI(): return list(map(int,input().split()))
def I(): return int(eval(input()))
def LS(): return input().split()
def S(): return eval(input())

def main():
  n,m=LI()

  l=[]
  for _ in range(m):
    a,b=LI()

    if a==1:
      l.append(b)
    elif b==n:
      l.append(a)

  x=len(l)
  y=len(list(set(l)))

  if x!=y:
    return 'POSSIBLE'
  return 'IMPOSSIBLE'

print((main()))
# Original solution
def solve():
    while 1:
        try:
            N, M = list(map(int, input().split(" ")))
            graph = [[0] * N for _ in range(N)]
            for _ in range(M):
                a, b = list(map(int, input().split(" ")))
                graph[a - 1][b - 1], graph[b - 1][a - 1] = 1, 1

            edges_from1 = graph[0].count(1)
            edges_fromN = graph[N - 1].count(1)
            if not edges_from1 or not edges_fromN:
                print("IMPOSSIBLE")
                break

            if edges_from1 < edges_fromN:
                start_node = 0
                goal_node = N - 1
            elif edges_fromN < edges_from1:
                start_node = N - 1
                goal_node = 0
            else:
                start_node = 0
                goal_node = N - 1

            for j in range(N):
                if graph[start_node][j] == 1:
                    if graph[j][goal_node] == 1:
                        print("POSSIBLE")
                        raise EndLoop

            print("IMPOSSIBLE")
        except:
            break


solve()

# Optimized solution
def solve():
    while 1:
        try:
            N, M = list(map(int, input().split(" ")))
            graph = [[None] * N for _ in range(N)]
            for _ in range(M):
                a, b = list(map(int, input().split(" ")))
                graph[a - 1][b - 1], graph[b - 1][a - 1] = 1, 1

            edges_from1 = graph[0].count(1)
            edges_fromN = graph[N - 1].count(1)
            if not edges_from1 or not edges_fromN:
                print("IMPOSSIBLE")
                break

            if edges_fromN < edges_from1:
                start_node = N - 1
                goal_node = 0
            else:
                start_node = 0
                goal_node = N - 1

            for j in range(N):
                if graph[start_node][j] == 1:
                    if graph[j][goal_node] == 1:
                        print("POSSIBLE")
                        raise EndLoop

            print("IMPOSSIBLE")
        except:
            break


solve()
# Original solution
#!/usr/bin/python
# -*- coding: utf-8 -*-
import sys
import os
from collections import OrderedDict, deque
from bisect import bisect_left, bisect_right, insort_left, insort_right


class EndLoop(Exception):
    pass


def solve():
    while 1:
        try:
            N, M = list(map(int, input().split(" ")))
            Deque1 = deque()
            DequeN = deque()
            edges_1 = [None] * N
            edges_N = [None] * N
            Deque1.extend(edges_1)
            DequeN.extend(edges_N)

            for _ in range(M):
                a, b = list(map(int, input().split(" ")))
                if a == 1:
                    Deque1[b - 1] = True
                elif b == 1:
                    Deque1[a - 1] = True
                elif a == N:
                    DequeN[b - 1] = True
                elif b == N:
                    DequeN[a - 1] = True
                else:
                    pass

            for i in range(N):
                if Deque1[i] == True and DequeN[i] == True:
                    print("POSSIBLE")
                    raise EndLoop

            print("IMPOSSIBLE")
            break
        except:
            break


solve()

# Optimized solution
#!/usr/bin/python
# -*- coding: utf-8 -*-
from collections import deque


class EndLoop(Exception):
    pass


def solve():
    while 1:
        try:
            N, M = list(map(int, input().split(" ")))
            Deque1 = deque()
            DequeN = deque()
            edges_1 = [False] * N
            edges_N = [False] * N
            Deque1.extend(edges_1)
            DequeN.extend(edges_N)

            for _ in range(M):
                a, b = list(map(int, input().split(" ")))
                if a == 1:
                    Deque1[b - 1] = True
                elif b == 1:
                    Deque1[a - 1] = True
                elif a == N:
                    DequeN[b - 1] = True
                elif b == N:
                    DequeN[a - 1] = True
                else:
                    pass

            for i in range(N):
                if Deque1[i] == True and DequeN[i] == True:
                    print("POSSIBLE")
                    raise EndLoop

            print("IMPOSSIBLE")
            break
        except:
            break


solve()
# Original solution
N, M = list(map(int, input().split()))
ship1 = set([])
ship2 = set([])
for i in range(M):
    a, b = list(map(int, input().split()))
    if a == 1:
        ship1.add(b)
    elif b == N:
        ship2.add(a)

if len(ship1 & ship2) == 0:
    print('IMPOSSIBLE')
else:
    print('POSSIBLE')

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

N, M = list(map(int, input().split()))
ship1 = set([])
ship2 = set([])
for i in range(M):
    a, b = list(map(int, input().split()))
    if a == 1:
        ship1.add(b)
    elif b == N:
        ship2.add(a)

if ship1 & ship2:
    print('POSSIBLE')
else:
    print('IMPOSSIBLE')
# Original solution
n,m=list(map(int,input().split()))
l=sorted([list(map(int,input().split())) for _ in range(m)])
ans=0
a=0
for i in range(m):
    if l[i][0]!=1:
        a=i
        break
for i in range(a):
    for j in range(a,m):
        if set(l[i])^set(l[j])=={1,n}:
            ans=1
            break
print(("POSSIBLE" if ans==1 else "IMPOSSIBLE"))

# Optimized solution
n,m=list(map(int,input().split()))
sa=set()
sb=set()
for i in range(m):
    a,b=list(map(int,input().split()))
    if a==1:sa.add(b)
    if b==n:sb.add(a)
print(("IMPOSSIBLE" if len(sa&sb)==0 else "POSSIBLE"))
# Original solution
def c_cat_snuke_and_a_voyage(N, M, I):
    p = [False] * N  # 島1と島iに辺があるならTrue,なければFalse(0-indexed)
    q = [False] * N  # 島iと島Nに辺があるならTrue,なければFalse(0-indexed)
    for a, b in I:
        if a == 1:  # 出発地が島1なら
            p[b] = True
        elif b == N:  # 目的地が島Nなら
            q[a] = True
    ans = 'IMPOSSIBLE'
    for i in range(N):
        if p[i] and q[i]:
            ans = 'POSSIBLE'
            break  # 1つでもあればいい
    return ans

N,M = [int(i) for i in input().split()]
I = [[int(i) for i in input().split()] for j in range(M)]
print((c_cat_snuke_and_a_voyage(N, M, I)))

# Optimized solution
def c_cat_snuke_and_a_voyage(N, M, I):
    node1 = [False] * N  # 島1と島iに辺があるならTrue, なければFalse
    node2 = [False] * N  # 島iと島Nに辺があるならTrue, なければFalse
    for a, b in I:
        if a == 1:  # 出発地が島1なら
            node1[b] = True
        elif b == N:  # 目的地が島Nなら
            node2[a] = True
    return 'POSSIBLE' if any([p and q for p, q in zip(node1, node2)]) else 'IMPOSSIBLE'

N, M = [int(i) for i in input().split()]
I = [[int(i) for i in input().split()] for j in range(M)]
print((c_cat_snuke_and_a_voyage(N, M, I)))
# Original solution
N,M=list(map(int,input().split()))
c1=[]
c2=[]
for i in range(M):
    a,b=list(map(int,input().split()))
    if a==1:
        c1.append(b)
    if b==N:
        c2.append(a)
for i in c1:
    if i in c2:
        print('POSSIBLE')
        exit()
print('IMPOSSIBLE')

# Optimized solution
N,M=list(map(int,input().split()))
c1=[]
c2=[]
for i in range(M):
    a,b=list(map(int,input().split()))
    if a==1:
        c1.append(b)
    if b==N:
        c2.append(a)
c1=set(c1)
c2=set(c2)
if c1&c2:
    print('POSSIBLE')
else:
    print('IMPOSSIBLE')
# Original solution
# ABC068 C - Cat Snuke and a Voyage
ni = lambda: int(eval(input()))
nm = lambda: list(map(int, input().split()))
nl = lambda: list(map(int, input().split()))

n,m = nm()
G = [[] for _ in range(n)]

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

# print(G)

for g in G:
    island_1toi = False
    island_iton = False
    for gg in g:
        if gg == 0:
            island_1toi = True
        if gg == n-1:
            island_iton = True

        if island_1toi == True and island_iton == True:
            print('POSSIBLE')
            exit()

print('IMPOSSIBLE')


# Optimized solution
n,m=list(map(int,input().split()))
eage=[[] for i in range(n)]
for i in range(m):
    a,b=list(map(int,input().split()))
    eage[a-1].append(b-1)
    eage[b-1].append(a-1)
for e in eage:
    i_to_1=False
    i_to_n=False
    for ee in e:
        if ee==0:
            i_to_1=True
        if ee==n-1:
            i_to_n=True
        
        if i_to_1==True and i_to_n==True:
            print('POSSIBLE')
            exit()
print('IMPOSSIBLE')
# Original solution
n, m = list(map(int, input().split()))

p = set()
q = set()

for _ in range(m):
    a, b = list(map(int, input().split()))
    if a == 1:
        p.add(b)
    elif b == n:
        q.add(a)
else:
    print(("POSSIBLE" if p & q else "IMPOSSIBLE"))

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

p = set()
q = set()
for _ in range(int(m)):
    a, b = input().split()
    if a == "1":
        p.add(b)
    elif b == n:
        q.add(a)
else:
    if p & q:
        print("POSSIBLE")
    else:
        print("IMPOSSIBLE")
# Original solution
e = []
n, m = list(map(int, input().split()))
for i in range(m):
    e.append(tuple(map(int, input().split())))

r = False
for a, b in [t for t in e if t[0] == 1]:
    if list([t for t in e if t[0] == b and t[1] == n]):
        r = True
        break
if r:
    print("POSSIBLE")
else:
    print("IMPOSSIBLE")


# Optimized solution
n, m = list(map(int, input().split()))
s = [False] * n
g = [False] * n
for i in range(m):
    a, b = list(map(int, input().split()))
    if a == 1:
        s[b] = True
    if b == n:
        g[a] = True

ans = "IMPOSSIBLE"
for i in range(n):
    if s[i] and g[i]:
        ans = "POSSIBLE"
        break
print(ans)
# Original solution
N,M = list(map(int,input().split()))
l,B_s,B_l = [],[],[]
for i in range(M):
    a,b = list(map(int,input().split()))
    if a == 1 :
        if b < N:
            B_s.append(b)
        elif b > N:
            B_l.append(b)        
    l.append([a,b])
for e in l:
    if e[0] in B_s and e[1] == N:
        print("POSSIBLE")
        break
    elif e[1] in B_l and e[0] == N:
        print("POSSIBLE")
        break
    elif e == l[-1]:
        print("IMPOSSIBLE")

# Optimized solution
N,M = list(map(int,input().split()))
l_s,l_l,B_s,B_l = [],[],[],[]
for i in range(M):
    a,b = list(map(int,input().split()))
    if a == 1 :
        if b < N:
            B_s.append(b) #Nより小さい
        elif b > N:
            B_l.append(b) #Nより大きい
    if a == N:
        l_l.append(b) #Nより大きい
    elif b == N:
        l_s.append(a) #Nより小さい
common_1 = len(list(set(l_s) & set(B_s)))
common_2 = len(list(set(l_l) & set(B_l)))
if common_1 > 0 or common_2 > 0:
    print("POSSIBLE")
else:
    print("IMPOSSIBLE")
# Original solution
N, M = list(map(int, input().split()))
lst1 = []
lst2 = []

for _ in range(M):
    a, b = list(map(int, input().split()))
    if a == 1:
        lst1.append(b)
    if b == N:
        lst2.append(a)

for x in lst1:
    if lst2.count(x) >= 1:
        print("POSSIBLE")
        exit()

print("IMPOSSIBLE")


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

for _ in range(M):
    a, b = list(map(int, input().split()))
    if a == 1:
        s1.add(b)
    if b == N:
        s2.add(a)

if len(s1.intersection(s2)) > 0:
    print("POSSIBLE")
else:
    print("IMPOSSIBLE")
# Original solution
n,m=list(map(int,input().split()))
x=[]
f=0
for i in range(m):
    a,b=list(map(int,input().split()))
    if a==1:
        if b in x:
            print("POSSIBLE")
            break
        x.append(b)
    if b==n:
        if a in x:
            print("POSSIBLE")
            break
        x.append(a)
else:
    print("IMPOSSIBLE")


# Optimized solution
n,m=list(map(int,input().split()))
x=[]
for i in range(m):
    a,b=list(map(int,input().split()))
    if a==1:
        x.append(b)
    if b==n:
        x.append(a)
l=len(x)
if len(set(x))==l:
    print("IMPOSSIBLE")
else:
    print("POSSIBLE")
# Original solution
n, m = list(map(int, input().split()))
f = [0]*200020
s = [0]*200020


for i in range(m):
    a, b = list(map(int, input().split()))
    if a == 1 or b == 1:
        f[max(a, b)] = 1
        if s[max(a, b)] == 1:
            print("POSSIBLE")
            exit()
    if a == n or b == n:
        s[min(a, b)] = 1
        if f[min(a, b)] == 1:
            print("POSSIBLE")
            exit()
print("IMPOSSIBLE")

# Optimized solution
n, m = list(map(int, input().split()))
f = {}
s = {}


for i in range(m):
    a, b = list(map(int, input().split()))
    if a == 1:
        f[b] = 1
        if b in s:
            print("POSSIBLE")
            exit()
    if b == n:
        s[a] = 1
        if a in f:
            print("POSSIBLE")
            exit()
print("IMPOSSIBLE")
# Original solution
N, M = list(map(int, input().split()))
c = []

for i in range(M):
    a, b = list(map(int, input().split()))
    if a == 1:
        c.append(b)
    elif b == N:
        c.append(a)

for i in range(N):
    if c.count(i) == 2:
        print('POSSIBLE')
        exit()

print('IMPOSSIBLE')

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

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

if A & B:
    print('POSSIBLE')
else:
    print('IMPOSSIBLE')