CodeEff/ECCO huggingface dataset:
# Original solution
N,M = list(map(int, input().split()))
A,B = [],[]
AtN,Bf1 = [],[]
for i in range(M):
    a,b = list(map(int, input().split()))
    if a == 1:
        Bf1 += [b]
    elif b == N:
        AtN += [a]

if (any((b in AtN) for b in Bf1)):
    print("POSSIBLE")
else:
    print("IMPOSSIBLE")

# Optimized solution
N,M = list(map(int, input().split()))
AtN,Bf1 = set(),set()
for i in range(M):
    a,b = list(map(int, input().split()))
    if a == 1:
        Bf1.add(b)
    elif b == N:
        AtN.add(a)

if (any((b in AtN) for b in Bf1)):
    print("POSSIBLE")
else:
    print("IMPOSSIBLE")
# Original solution
N,M=list(map(int,input().split()))
nekotyann=[]
wanntyann=[]
ans="IMPOSSIBLE"
for i in range(M):
    a,b=list(map(int,input().split()))
    if a==1:
        nekotyann.append(b)
    if b==N:
        wanntyann.append(a)
for i in range(len(wanntyann)):
    if wanntyann[i] in nekotyann:
        ans="POSSIBLE"
        break
print(ans)


# Optimized solution
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)
# Original solution
N, M = list(map(int, input().split()))
s = [[] for i in range(N+1)]
e = [[] for i in range(N+1)]
for i in range(M):
    a, b = list(map(int, input().split()))
    s[a].append(b)
    e[b].append(a)

for i in s[1]:
    for j in e[N]:
        if i == j:
            print('POSSIBLE')
            exit()

print('IMPOSSIBLE')

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

for i in s[1]:
    if N in s[i]:
        print('POSSIBLE')
        exit()

print('IMPOSSIBLE')
# Original solution
n, m = (int(i) for i in input().split())
a,b = [0 for i in range(m)],[0 for i in range(m)]
g = [[0 for i in range(m)] for j in range(m)]
OK = False 
for i in range(m):
    a[i],b[i] = list(map(int, input().split()))
    a[i]-=1
    b[i]-=1

for i in range(m):
    if a[i]==0:
        v = b[i]
        for j in range(m):
            if a[j]==v and b[j]==n-1:
                OK = True
print(('POSSIBLE' if OK else 'IMPOSSIBLE'))


# Optimized solution
n, m = (int(i) for i in input().split())
a,b = [0 for i in range(m)],[0 for i in range(m)]
g = [[] for i in range(n)]
OK = False 
for i in range(m):
    a[i],b[i] = list(map(int, input().split()))
    a[i]-=1
    b[i]-=1
    g[a[i]].append(b[i])
    g[b[i]].append(a[i])
for i in range(m):
    if a[i]==0 and n-1 in g[b[i]]:
        OK = True
print(('POSSIBLE' if OK else 'IMPOSSIBLE'))
# Original solution
N, M = list(map(int, input().split()))
a = [0 for i in range(M)]
b = [0 for i in range(M)]
c = []
for i in range(M):
    a[i], b[i] = list(map(int, input().split()))
    if a[i] == 1:
        c.append(b[i])

flag = 0
for k in c:
    if k == N:
        flag = 1
        break
    else:
        for i in range(M):
            if a[i] == k and b[i] == N:
                flag = 1
                break
    if flag == 1:
        break

if flag == 0:
    print("IMPOSSIBLE")
else:
    print("POSSIBLE")


# Optimized solution
N, M = list(map(int, input().split()))
a = [0 for i in range(M)]
b = [0 for i in range(M)]
c = []
d = []
flag = 0
for i in range(M):
    a[i], b[i] = list(map(int, input().split()))
    if a[i] == 1:
        c.append(b[i])
        if b[i] == N:
            flag = 1
    if b[i] == N:
        d.append(a[i])
        if a[i] == 1:
            flag = 1
e = set(c) | set(d)
if len(c) + len(d) == len(e):
    flag = 0
else:
    flag = 1

if flag == 0:
    print("IMPOSSIBLE")
else:
    print("POSSIBLE")
# Original solution
def inpl(): return input().split()
def get_str(bl): return 'POSSIBLE' if bl else 'IMPOSSIBLE'

n, m = list(map(int, inpl()))
M = list(tuple(map(int, inpl())) for _ in range(m))#[(a, b), ..., (a, b)]
X = list(tuple((a, b)) for a, b in M if a == 1)
Y = list(tuple((a, b)) for a, b in M if b == n)
XB = set(list(b for _, b in X))
YA = set(list(a for a, _ in Y))
print((get_str(len(XB & YA) > 0)))

# Optimized solution
def main():
    import sys
    input = sys.stdin.readline

    N, M = list(map(int, input().split()))

    g = tuple(set() for _ in range(N))
    for _ in range(M):
        a, b = (int(x) - 1 for x in input().split())
        g[a].add(b)
        g[b].add(a)

    intersect = {u_1 for u_1 in g[0]} & {u_N for u_N in g[N - 1]}
    print(('POSSIBLE' if intersect else 'IMPOSSIBLE'))


if __name__ == '__main__':
    main()
# Original solution
# coding: utf-8
# Here your code !

a = list(map((int), input().split(' ')))
N, M = a[0], a[1]

first = []
second = []

for i in range(M):
    
    b = list(map((int),input().split(' ')))
    start, end = b[0], b[1]
    
    if start == 1:
        first.append(end)
    if end == N:
        second.append(start)
        
first_set = set(first)
second_set = set(second)

matched_l = list(first_set & second_set)

if matched_l is None or len(matched_l) == 0:
    print('IMPOSSIBLE')
else:
    print('POSSIBLE')


# Optimized solution
import sys

input = sys.stdin.readline

a = list(map((int), input().split(' ')))
N, M = a[0], a[1]
 
first = []
second = []
 
for i in range(M):
    
    b = list(map((int),input().split(' ')))
    start, end = b[0], b[1]
    
    if start == 1:
        first.append(end)
    if end == N:
        second.append(start)
        
first_set = set(first)
second_set = set(second)
 
matched_l = list(first_set & second_set)
 
if matched_l is None or len(matched_l) == 0:
    print('IMPOSSIBLE')
else:
    print('POSSIBLE')
# Original solution
N,M=list(map(int,input().split()))
A=[list(map(int,input().split())) for i in range(M)]
D=[[]for i in range(N)]
for i in range(M):
  D[A[i][0]-1].append(A[i][1]-1)
  D[A[i][1]-1].append(A[i][0]-1)
for i in D[-1]:
  for j in D[0]:
    if i==j:
      print('POSSIBLE')
      exit()
print('IMPOSSIBLE')  

# Optimized solution
N,M=list(map(int,input().split()))
A=[list(map(int,input().split())) for i in range(M)]
D=[[]for i in range(N)]
for i in range(M):
  D[A[i][0]-1].append(A[i][1]-1)
  D[A[i][1]-1].append(A[i][0]-1)
a=len(D[-1])
b=len(D[0])
c=len(set(D[-1]+D[0]))
if a+b==c:
  print('IMPOSSIBLE')
else:
  print('POSSIBLE')
# Original solution
N, M = list(map(int, input().split()))

start = []
goal = []
for i in range(M):
    a, b = list(map(int, input().split()))
    if a == 1:
        start.append(b)
    if b == N:
        goal.append(a)
    
for i in range(len(start)):
    if start[i] in goal:
        print("POSSIBLE")
        exit()

print("IMPOSSIBLE")

# Optimized solution
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)
    if b == N:
        goal.add(a)
    
if len(start & goal) != 0:
    print("POSSIBLE")
else:
    print("IMPOSSIBLE")
# Original solution
n,m=list(map(int,input().split()))
a1=[]
an=[]
for i in range(m):
    ai,bi=list(map(int,input().split()))
    if ai==1:
        a1.append(bi)
    elif bi==n:
        an.append(ai)

a1.sort()
an.sort()

flag = False

for i in range(len(a1)):
    if a1[i] in an:
        flag = True
        break
  
if flag==True:
    print("POSSIBLE")
else:
    print("IMPOSSIBLE")

# Optimized solution

n,m=list(map(int,input().split()))
a1=set()
an=set()
for i in range(m):
    ai,bi=list(map(int,input().split()))
    if ai==1:
        a1.add(bi)
    elif bi==n:
        an.add(ai)

if len(a1&an)==0:
    print("IMPOSSIBLE")
else:
    print("POSSIBLE")
# Original solution
n,m=list(map(int,input().split()))
r=[[] for i in range(n+1)]
#r=[]*(n+1)
for i in range(m):
    ai,bi=list(map(int,input().split()))
    if not bi in r[ai]:
        r[ai].append(bi)
        r[bi].append(ai)
yn=""
for i in range(2,n):
    if (i in r[1]) and (i in r[n]):
        print("POSSIBLE")
        yn="POSSIBLE"
        break
if yn=="":
    print("IMPOSSIBLE")

# Optimized solution
n,m=list(map(int,input().split()))
#r=[[] for i in range(n+1)]
r=[set() for i in range(n+1)]
for i in range(m):
    ai,bi=list(map(int,input().split()))
    if not bi in r[ai]:
#        r[ai].append(bi)
#        r[bi].append(ai)
        r[ai].add(bi)
        r[bi].add(ai)
yn=""
for i in range(2,n):
    if (i in r[1]) and (i in r[n]):
        print("POSSIBLE")
        yn="POSSIBLE"
        break
if yn=="":
    print("IMPOSSIBLE")
# Original solution
n,m=list(map(int,input().split()))
a=[[int(i) for i in input().split()]for i in range(m)]
s=set()
for i in a:
    if i[1]==n:
        s.add(i[0])
for i in a:
    if i[0]==1 and i[1] in s:
        print('POSSIBLE')
        exit()
print('IMPOSSIBLE')

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

if flag==False:
    print("IMPOSSIBLE")
else:
    print("POSSIBLE")


# Optimized solution
N,M=[int(i) for i in input().split()]
a=[]
b=[]
c=[]
for i in range(M):
    x,y=[int(i) for i in input().split()]
    if x==1 :
        c.append(y)
    if y==N:
        c.append(x)
if len(c)==len(set(c)):
    print("IMPOSSIBLE")
else:
    print("POSSIBLE")
# Original solution
#真に大切なのは中間点となる要素
N, M = list(map(int, input().split()))
an = set()
nb = set()
for i in range(M):
    a, b = list(map(int, input().split()))
    if a == 1:
        an.add(b)
    elif b == N:
        nb.add(a)

print(('IMPOSSIBLE' if len(an&nb)==0 else 'POSSIBLE'))

# Optimized solution
#真に大切なのは中間点となる要素
N, M = list(map(int, input().split()))
an = []
nb = []
for i in range(M):
    a, b = list(map(int, input().split()))
    if a == 1:
        an.append(b)
    elif b == N:
        nb.append(a)

print(('IMPOSSIBLE' if len(set(an)&set(nb))==0 else 'POSSIBLE'))
# Original solution
n,m=list(map(int,input().split()))
data=[]
for i in range(m):
  a,b=list(map(int,input().split()))
  if a==1:
    if b not in data:
      data.append(b)
    else:
      print('POSSIBLE')
      exit()
  elif b==n:
    if a not in data:
      data.append(a)
    else:
      print('POSSIBLE')
      exit()
print('IMPOSSIBLE')

# Optimized solution
n,m=list(map(int,input().split()))
data=[0]*n
for i in range(m):
  a,b=list(map(int,input().split()))
  if a==1:
    data[b-1]+=1
    if data[b-1]==2:
      print('POSSIBLE')
      exit()
  if b==n:
    data[a-1]+=1
    if data[a-1]==2:
      print('POSSIBLE')
      exit()
print('IMPOSSIBLE')
# Original solution
# -*- coding: utf-8 -*-

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

transit = []
transit2 = []
for i in range(M):
    if abM[i][0] == 1:
        transit.append(abM[i][1])
    if abM[i][1] == N:
        transit2.append(abM[i][0])

# setで共通要素の集合を取ってみる
if len(set(transit) & set(transit2)) != 0:
    print("POSSIBLE")
else:
    print("IMPOSSIBLE")

# Optimized solution
# -*- coding: utf-8 -*-

N, M = list(map(int, input().split()))

# 1からある島への便があるかを保持
transit = [False] * N
# ある島からNへの便があるかを保持
transit2 = [False] * N

for i in range(M):
    a, b = list(map(int, input().split()))
    if a == 1:
        transit[b] = True
    if b == N:
        transit2[a] = True

for i in range(N):
    if transit[i] and transit2[i]:
        print("POSSIBLE")
        exit()
print("IMPOSSIBLE")
# Original solution
n,m = list(map(int,input().split()))
a_to = []
a_from = []
for i in range(m):
    a,b = list(map(int,input().split()))
    if a==1:
        a_to.append(b)
    if b==1:
        a_to.append(a)
    if a==n:
        a_from.append(b)
    if b==n:
        a_from.append(a)
isOK = False
for j in range(len(a_to)):
    if a_to[j] in a_from:
        isOK = True
        break
#print(a_to)
#print(a_from)
if isOK:
    print('POSSIBLE')
else:
    print('IMPOSSIBLE')


# Optimized solution
n,m = list(map(int,input().split()))
#a_to = []
#a_from = []
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 a==1:
#        a_to.append(b)
#    if b==1:
#        a_to.append(a)
#    if a==n:
#        a_from.append(b)
#    if b==n:
#        a_from.append(a)

#for j in range(len(a_to)):
#    if a_to[j] in a_from:
#        isOK = True
#        break
#print(a_to)
#print(a_from)
if isOK:
    print('POSSIBLE')
else:
    print('IMPOSSIBLE')
# Original solution
#ABC068C
N,M=list(map(int,input().split()))
A=[]
B=[]
C=[]
D=[]
for m in range(M):
	I=list(map(int,input().split()))
	if I[0]==1:
		A.append(I[0])
		B.append(I[1])
	if I[1]==N:
		C.append(I[0])
		D.append(I[1])
for b in B:
	for c in C:
		if b==c:
			print('POSSIBLE')
			exit()
print('IMPOSSIBLE')

# Optimized solution
#ABC068C
N,M=list(map(int,input().split()))
A=[]
B=[]
C=[]
D=[]
for m in range(M):
	I=list(map(int,input().split()))
	if I[0]==1:
		A.append(I[0])
		B.append(I[1])
	elif I[1]==N:
		C.append(I[0])
		D.append(I[1])
if len(set(B)&set(C))>0:
	print('POSSIBLE')
else:
	print('IMPOSSIBLE')
# Original solution
import sys

n,m = list(map(int, sys.stdin.readline().split()))
ab = [[0, 0]]*m
for i in range(m):
    ab[i] = list(map(int, sys.stdin.readline().split()))

tmp = []
for i in ab:
    if i[0] == 1:
        tmp.append(i[1])

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

flag = False
for i in tmp:
    if i in tmp_n:
        flag = True
        break

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


# Optimized solution
import sys

n,m = list(map(int, sys.stdin.readline().split()))

mid1 = set()
mid2 = set()
for _ in range(m):
    a,b, = list(map(int, input().split()))
    if a == 1:
        mid1.add(b)
    elif b == n:
        mid2.add(a)
result = bool(mid1 & mid2)
if result:
    print("POSSIBLE")
else:
    print("IMPOSSIBLE")
# Original solution
N, M = list(map(int, input().split()))
starts = []
goals = []
for _ in range(M):
    s, g = list(map(int, input().split()))
    if s == 1:
        starts.append(g)
    elif g == N:
        goals.append(s)

for i in starts:
    if i in goals:
        print("POSSIBLE")
        exit()
        
print("IMPOSSIBLE")

# Optimized solution
N, M = list(map(int, input().split()))
starts = []
goals = []
for _ in range(M):
    s, g = list(map(int, input().split()))
    if s == 1:
        starts.append(g)
    elif g == N:
        goals.append(s)

ans = set(starts) & set(goals)

if len(ans) >= 1:
    print("POSSIBLE")
else:
    print("IMPOSSIBLE")
# Original solution
n,m=list(map(int,input().split()))
ab=[[int(i) for i in input().split()] for j in range(m)]

li=[[] for i in range(n+1)]

for a,b in ab:
    li[a].append(b)

li2=[]
for i in li[1]:
    li2.append(i)

ans=False
for i in li2:
    if n in li[i]:
        ans=True
print(('POSSIBLE' if ans else 'IMPOSSIBLE'))

# Optimized solution
import sys
input = sys.stdin.readline
n,m=list(map(int,input().split()))
ab=[[int(i) for i in input().split()] for j in range(m)]

li=[[] for i in range(n+1)]

for a,b in ab:
    li[a].append(b)

li2=[]
for i in li[1]:
    li2.append(i)

ans=False
for i in li2:
    if n in li[i]:
        ans=True
print(('POSSIBLE' if ans else 'IMPOSSIBLE'))
# Original solution
N, M = [int(i) for i in input().split()]

S, G = set(), set()
for _ in range(M):
    a, b = [int(i) for i in input().split()]
    if a == 1:
        S.add(b)
    if b == N:
        G.add(a)

if any(s in G for s in S):
    print("POSSIBLE")
else:
    print("IMPOSSIBLE")

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

S, G = set(), set()
for _ in range(M):
    a, b = [int(i) for i in input().split()]
    if a == 1:
        S.add(b)
    if b == N:
        G.add(a)

if len(S & G) >= 1:
    print("POSSIBLE")
else:
    print("IMPOSSIBLE")
# Original solution
N, M = [int(i) for i in input().split()]

S, G = set(), set()
for _ in range(M):
    a, b = [int(i) for i in input().split()]
    if a == 1:
        S.add(b)
    if b == N:
        G.add(a)

if len(S & G) >= 1:
    print("POSSIBLE")
else:
    print("IMPOSSIBLE")

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

S, G = [False] * N, [False] * N
for _ in range(M):
    a, b = [int(i) for i in input().split()]
    if a == 1:
        S[b - 1] = True
    if b == N:
        G[a - 1] = True

if any(s and g for s, g in zip(S, G)):
    print("POSSIBLE")
else:
    print("IMPOSSIBLE")
# Original solution
N, M = list(map(int, input().split()))
S = [[] for i in range(N)]
for i in range(M):
    a, b = list(map(int, input().split()))
    S[a-1].append(b-1)
    S[b-1].append(a-1)

for b in S[0]:
    if N-1 in S[b]:
        print("POSSIBLE")
        break
else:
    print("IMPOSSIBLE")

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

print(("POSSIBLE" if set(S[0]) & set(S[N-1]) else "IMPOSSIBLE"))
# Original solution
n,m = list(map(int,input().split()))
V = [[] for i in range(n+1)]
for i in range(m):
    a,b = list(map(int,input().split()))
    V[a].append(b)
    V[b].append(a)
from collections import deque
q = deque([])
q.append(1)
reach = [0]*(n+1)
reach[0] = -1
while q:
    x = q.popleft()
    for v in V[x]:
        if reach[v] == 0:
            q.append(v)
            reach[v] = reach[x]+1
    if max(reach) >= 3:
        break
if reach[-1] == 2:
    print("POSSIBLE")
else:
    print("IMPOSSIBLE")

# Optimized solution
n,m = list(map(int,input().split()))
V = [[] for i in range(n+1)]
for i in range(m):
    a,b = list(map(int,input().split()))
    V[a].append(b)
    V[b].append(a)
W = V[1]
z = []
for x in W:
    z.append(V[x])
s = 0
for q in z:
    if n in q:
        s = 1
        break
if s == 1:
    print("POSSIBLE")
else:
    print("IMPOSSIBLE")
# Original solution
n,m = list(map(int,input().split()))
ab = [list(map(int,input().split())) for _ in range(m)]
ab.sort()
mid = []
cand = []
mid_id = 0
for i in range(m):
  if ab[i][0] == 1:
    mid.append(ab[i][1])
  elif ab[i][0] == n or ab[i][1] == n:
    cand.append(ab[i])

if len(mid) == 0:
  print('IMPOSSIBLE')
  exit()
  
for j in range(len(cand)):
  if cand[j][0] in mid and cand[j][1] == n:
    print('POSSIBLE')
    exit()
  elif cand[j][1] in mid and cand[j][0] == n:
    print('POSSIBLE')
    exit()

print('IMPOSSIBLE')

# Optimized solution
n,m = list(map(int,input().split()))
ab = [list(map(int,input().split())) for _ in range(m)]
ab.sort()
mid = []
cand = []
for i in range(m):
  if ab[i][0] == 1:
    mid.append(ab[i][1])
  elif ab[i][0] == n:
    cand.append(ab[i][1])
  elif ab[i][1] == n:
    cand.append(ab[i][0])    

if len(set(mid) & set(cand)) > 0:
  print('POSSIBLE')
else:
  print('IMPOSSIBLE')
# Original solution
from collections import deque
n,m=[int(i) for i in input().split()]
a_to=deque([])
to_b=deque([])
for i in range(m):
    a,b=[int(i) for i in input().split()]
    if a==1:
        a_to.append(b)
    if b==n:
        to_b.append(a)
for i in a_to:
    if i in to_b:
        print("POSSIBLE")
        break
else:
    print("IMPOSSIBLE")

# Optimized solution
n,m=[int(i) for i in input().split()]
a_to_b=[0]*n
for i in range(m):
    a,b=[int(j) for j in input().split()]
    if a==1:
        a_to_b[b]+=1
    if b==n:
        a_to_b[a]+=1
if 2 in a_to_b:
    print("POSSIBLE")
else:
    print("IMPOSSIBLE")
# Original solution
import sys
sys.setrecursionlimit(200010)
def input():
    return sys.stdin.readline()[:-1]

def main():
    N, M = list(map(int,input().split()))
    G = [[] for k 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)
    for e in G[0]:
        if e in G[N-1]:
            print("POSSIBLE")
            exit(0)
    print("IMPOSSIBLE")
if __name__ == '__main__':
    main()


# Optimized solution
import sys
sys.setrecursionlimit(200010)
def input():
    return sys.stdin.readline()[:-1]

def main():
    N, M = list(map(int,input().split()))
    G = [set([]) for k in range(N)]
    for i in range(M):
        A, B = set(map(int,input().split()))
        G[A-1].add(B-1)
        G[B-1].add(A-1)
    for e in G[0]:
        if e in G[N-1]:
            print("POSSIBLE")
            exit(0)
    print("IMPOSSIBLE")
if __name__ == '__main__':
    main()
# Original solution
N,M=list(map(int,input().split()))
L1=[]
LN=[]
for i in range(M):
    a,b=list(map(int,input().split()))
    if a==1:
        if b in LN:
            print("POSSIBLE")
            exit()
        else:
            L1.append(b)
    elif b==N:
        if a in L1:
            print("POSSIBLE")
            exit()
        else:
            LN.append(a)
print("IMPOSSIBLE")

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

Start=[]
Goal=[]

for i in range(M):
    a,b=list(map(int,input().split()))
    if a==1:
        Start.append(b)
    elif b==1:
        Start.append(a)
    if a==N:
        Goal.append(b)
    elif b==N:
        Goal.append(a)
    
S=set(Start)
G=set(Goal)
if len(S&G)>0:
    print("POSSIBLE")
elif len(S&G)==0:
    print("IMPOSSIBLE")
# Original solution
N,M = list(map(int, input().split()))
AB = [list(map(int, input().split())) for _ in range(M)]

first_to = []
to_dest = []

for ab in AB:
    if ab[0] == 1:
        first_to.append(ab[1])
    elif ab[1] == N:
        to_dest.append(ab[0])

for f in first_to:
    if f in to_dest:
        print('POSSIBLE')
        break
else:
    print('IMPOSSIBLE')


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

first_to = []
to_dest = []

for ab in AB:
    if ab[0] == 1:
        first_to.append(ab[1])
    elif ab[1] == N:
        to_dest.append(ab[0])
first_to = set(first_to)
to_dest = set(to_dest)

for f in first_to:
    if f in to_dest:
        print('POSSIBLE')
        break
else:
    print('IMPOSSIBLE')
# Original solution
n,m=list(map(int,input().split()))

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


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

from_1=[]
to_n=[]
for i in range(m):
    a,b=list(map(int,input().split()))
    if a==1:
        from_1.append(b)
    if b==n:
        to_n.append(a)

if len(set(from_1) & set(to_n)) >= 1:
    print('POSSIBLE')
else:
    print('IMPOSSIBLE')
# Original solution
import itertools
n,m=list(map(int,input().split()))
AB=[list(map(int,input().split())) for _ in range(m)]

for ship1,ship2 in list(itertools.combinations(AB,2)):
  now=ship1[0]
  if now==1:
    now=ship1[1]
    if now==ship2[0] and ship2[1]==n:
      print('POSSIBLE')
      exit()
  now=ship2[0]
  if now==1:
    now=ship2[1]
    if now==ship1[0] and ship1[1]==n:
      print('POSSIBLE')
      exit()
print('IMPOSSIBLE')

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

next=set()
for a,b in AB:
  if a==1:
    next.add(b)
for a,b in AB:
  if a in next and b==n:
    print('POSSIBLE')
    exit()
print('IMPOSSIBLE')