CodeEff/ECCO huggingface dataset:
# Original solution
N,M = list(map(int,input().split()))
a = [list(map(int,input().split())) for i in range(M)]
b = []
c = []
for i in a:
    if i[0]==1:
        b.append(i)
    elif i[1]==N:
        c.append(i)
for i in b:
  for j in c:
    if i[1]==j[0]:
    	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)]
b = set()
for i in a:
    if i[0]==1 or i[1]==N:
        b.add((i[0],i[1]))
for i in range(2,N):
    if (1,i) in b and (i,N) in b:
    	print('POSSIBLE')
    	exit()
print('IMPOSSIBLE')
# Original solution
import sys

input = sys.stdin.readline

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

for _ in range(M):
    a, b = list(map(int, input().split(" ")))
    if a < b:
        m.add((a,b))
    else:
        m.add((b,a))


for i in range(2, N):
    if (1, i) in m and (i, N) in m:
        print("POSSIBLE")
        break
else:
    print("IMPOSSIBLE")



# Optimized solution
import sys

input = sys.stdin.readline

def main():
    N, M = list(map(int, input().split(" ")))
    m = set()
    for _ in range(M):
        a, b = list(map(int, input().split(" ")))
        if a < b:
            m.add((a,b))
        else:
            m.add((b,a))
    for i in range(2, N):
        if (1, i) in m and (i, N) in m:
            print("POSSIBLE")
            break
    else:
        print("IMPOSSIBLE")
main()
# Original solution
import sys

input = sys.stdin.readline

def main():
    N, M = list(map(int, input().split(" ")))
    m = set()
    for _ in range(M):
        a, b = list(map(int, input().split(" ")))
        if a < b:
            m.add((a,b))
        else:
            m.add((b,a))
    for i in range(2, N):
        if (1, i) in m and (i, N) in m:
            print("POSSIBLE")
            break
    else:
        print("IMPOSSIBLE")
main()

# Optimized solution
import sys

input = sys.stdin.readline

def main():
    N, M = list(map(int, input().split()))
    m = set()
    for _ in range(M):
        a, b = list(map(int, input().split()))
        if a < b:
            m.add((a,b))
        else:
            m.add((b,a))
    for i in range(2, N):
        if (1, i) in m and (i, N) in m:
            print("POSSIBLE")
            break
    else:
        print("IMPOSSIBLE")
main()
# Original solution
n, m = list(map(int, input().split()))
c = [False for i in range(200001)]
d = [False for i in range(200001)]
for i in range(m):
	a, b = list(map(int, input().split()))
	if a == 1:
		c[b] = True
	if b == n:
		d[a] = True
for i in range(200001):
	if c[i] and d[i]:
		print ("POSSIBLE")
		exit()
print ("IMPOSSIBLE")

# Optimized solution
n, m = list(map(int, input().split()))
c = [False for i in range(200000)]
d = [False for i in range(200000)]
for i in range(m):
	a, b = list(map(int, input().split()))
	if a == 1:
		c[b] = True
	if b == n:
		d[a] = True
for i in range(200000):
	if c[i] and d[i]:
		print ("POSSIBLE")
		exit()
print ("IMPOSSIBLE")
# Original solution
n,m=list(map(int,input().split()))
ab=[]
for i in range(m):
  a,b=list(map(int,input().split()))
  ab.append((a,b))
#print(ab)
     
mid=[]
for (i,j) in ab:
  if i==1:
    mid.append(j)

for (i,j) in ab:
  if i in mid and j==n:
    print("POSSIBLE");exit()
    
print("IMPOSSIBLE")

    

# Optimized solution
n,m=list(map(int,input().split()))
c=[]
d=[]
for i in range(m):
  a,b=list(map(int,input().split()))
  if a==1:
    c.append(b)
  if b==n:
    d.append(a)
#O(m)
if len(set(c)&set(d))!=0:
  print("POSSIBLE")
else:
  print("IMPOSSIBLE")
# Original solution
n, m = list(map(int, input().split()))
ships = [[int(x) for x in input().split()] for x in range(m)]

judge = False
relay = []
goal = []

for ship in ships:
    if n in ship:
        goal.append(ship[0])
    elif 1 in ship:
        relay.append(ship[1])

res = False
if len(goal) == 0 or len(relay) == 0:
    print("IMPOSSIBLE")
else:
    for i in relay:
        if i in goal:
            res = True
            break
    print(("POSSIBLE" if res else "IMPOSSIBLE"))

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

judge = False
relay = []
goal = []

for ship in ships:
    if n in ship:
        goal.append(ship[0])
    elif 1 in ship:
        relay.append(ship[1])

res = False
if len(goal) == 0 or len(relay) == 0:
    print("IMPOSSIBLE")

else:
    print(("IMPOSSIBLE" if not set(relay) & set(goal) else "POSSIBLE"))
# Original solution
#!/usr/bin/env python3
# -*- coding: utf-8 -*-


def main():
    N, M = list(map(int, input().split()))
    AB = [list(map(int, input().split())) for _ in range(M)]
    A = [b for a, b in AB if a == 1]
    B = [a for a, b in AB if b == N]

    result = 'IMPOSSIBLE'
    for a in A:
        if a in B:
            result = 'POSSIBLE'
    print(result)


if __name__ == "__main__":
    main()


# Optimized solution
#!/usr/bin/env python3
# -*- coding: utf-8 -*-


def main():
    N, M = list(map(int, input().split()))
    # AB = [list(map(int, input().split())) for _ in range(M)]
    from_1 = [False] * N
    to_N = [False] * N
    for _ in range(M):
        a, b = list(map(int, input().split()))
        if a == 1:
            from_1[b - 1] = True
        elif b == N:
            to_N[a - 1] = True
    for i in range(1, N):
        if from_1[i] and to_N[i]:
            print('POSSIBLE')
            break
    else:
        print('IMPOSSIBLE')


if __name__ == "__main__":
    main()
# Original solution
# C - Cat Snuke and a Voyage
N,M = list(map(int, input().split()))
A = [list(map(int, input().split())) for i in range(M)]
goal2 = []
goal1 = []
for i in range(M):
    if A[i][1] == N:
        goal2.append(A[i][0])
    elif A[i][0] == 1:
        goal1.append(A[i][1])
    else:
        pass

for k in range(len(goal1)):
    if goal1[k] in goal2:
        print("POSSIBLE")
        exit()
print("IMPOSSIBLE")


# Optimized solution
# C - Cat Snuke and a Voyage
N,M = list(map(int, input().split()))
A = [list(map(int, input().split())) for i in range(M)]
goal2 = []
goal1 = []
for i in range(M):
    if A[i][1] == N:
        goal2.append(A[i][0])
    elif A[i][0] == 1:
        goal1.append(A[i][1])
    else:
        pass

if len(set(goal1)&set(goal2)) != 0:
    print("POSSIBLE")
else:
    print("IMPOSSIBLE")
# Original solution
N,M=[int(x) for x in input().split()]
set1=set()
setn=set()
for i in [None]*M:
    ipt=[int(x) for x in input().split()]
    if 1 in ipt:
        set1 = set1.union(ipt)
    if N in ipt:
        setn = setn.union(ipt)
if set1 & setn:
    print("POSSIBLE")
else:
    print("IMPOSSIBLE")

# Optimized solution
N,M=[int(x) for x in input().split()]
set1=[]
setn=[]
for i in [None]*M:
    ipt=[int(x) for x in input().split()]
    if 1 in ipt:
        set1 += ipt
    if N in ipt:
        setn += ipt
if set(set1) & set(setn):
    print("POSSIBLE")
else:
    print("IMPOSSIBLE")
# Original solution
import sys
input = sys.stdin.readline
def main():
   N,M = list(map(int,input().split()))
   Set = set()
   for i in range(M):
      a,b = list(map(int,input().split()))
      Set.add((a,b))
      Set.add((b,a))                        #ADD
      for j in range(2,N):
         if (1,j) in Set and (j,N) in Set:
            print("POSSIBLE")
            return
   else:
       print("IMPOSSIBLE")

main()


# Optimized solution
import sys
input = sys.stdin.readline
def main():
   N,M = list(map(int,input().split()))
   Set = set()
   for i in range(M):
      a,b = list(map(int,input().split()))
      Set.add((a,b))
      Set.add((b,a))                        #condition
   for j in range(2,N):
      if (1,j) in Set and (j,N) in Set:
         print("POSSIBLE")
         return
   print("IMPOSSIBLE")

main()
# Original solution
N, M = list(map(int, input().split()))
ab=[]
for _ in range(M):
    ab.append(tuple(map(int, input().split())))
#print(ab)

for island in range(2,N):
    if (1,island) in ab and (island,N) in ab:
        print('POSSIBLE')
        break
else:
    print('IMPOSSIBLE')

# Optimized solution
N, M = list(map(int, input().split()))
ab=[]
for _ in range(M):
    ab.append(tuple(map(int, input().split())))
#print(ab)

from_1=set([el[1] for el in ab if el[0]==1])
from_N=set([el[0] for el in ab if el[1]==N])
#print(from_1, from_N)
if from_1 & from_N:
    print('POSSIBLE')
else:
    print('IMPOSSIBLE')
# Original solution
N, M = list(map(int,input().split()))
ab = [list(map(int,input().split())) for i in range(M)]
c = []
d = []
ans = "IMPOSSIBLE"
for i in range(M):
    if ab[i][0] == 1:
        c.append(ab[i][1])
    elif ab[i][1] == N:
        d.append(ab[i][0])
for i in range(len(c)):
    if c[i] in d:
        ans = "POSSIBLE"
        break
print(ans)

# Optimized solution
N, M = list(map(int,input().split()))
ab = [list(map(int,input().split())) for i in range(M)]
c = []
d = []
ans = "IMPOSSIBLE"
for i in range(M):
    if ab[i][0] == 1:
        c.append(ab[i][1])
    elif ab[i][1] == N:
        d.append(ab[i][0])
e = list(set(c + d))
if len(e) < len(c)+ len(d):
    ans = "POSSIBLE"
print(ans)
# Original solution
N,M = list(map(int,input().split()))
root1 = []
root2 = []
for i in range(M):
    ai,bi = list(map(int,input().split()))
    if ai==1:
        tmp = [ai,bi]
        root1.append(tmp)
    else:
        tmp = [ai,bi]
        root2.append(tmp)
for i in range(len(root1)):
    for j in range(len(root2)):
        if root1[i][1]==root2[j][0]:
            if root2[j][1]==N:
                print('POSSIBLE')
                exit()
print('IMPOSSIBLE')

# Optimized solution
N,M = list(map(int,input().split()))
root1 = set()
root2 = set()
for i in range(M):
    ai,bi = list(map(int,input().split()))
    if ai==1:
        root1.add(bi)
    if bi==N:
        root2.add(ai)
if set(root1) & set(root2):
    print('POSSIBLE')
else:
    print('IMPOSSIBLE')
# Original solution
N, M = list(map(int, (input().split())))
L = [[0 for i in range(N)] for j in range(N)]
for i in range(M):
    a, b = list(map(int, input().split()))
    L[a - 1][b - 1] = 1
    L[b - 1][a - 1] = 1
#print(L)
for i in range(N):
    if L[0][i] == 1:
        if L[i][N - 1] == 1:
            print("POSSIBLE")
            exit()
print("IMPOSSIBLE")


# Optimized solution
N, M = list(map(int, (input().split())))
L1 = [0 for i in range(N)]
L2 = [0 for j in range(N)]
for i in range(M):
    a, b = list(map(int, input().split()))
    if a == 1:
        L1[b - 1] = 1
    elif b == N:
        L2[a - 1] = 1
for i in range(N):
    if L1[i] == L2[i] == 1:
        print("POSSIBLE")
        exit()
print("IMPOSSIBLE")
# Original solution
from sys import stdin
input = stdin.readline

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

ans = "IMPOSSIBLE"

seta,setb = set(),set()
af,bf = [False]*M,[False]*M

for m in range(M):
    a,b = list(map(int,(input().split())))
    if a-1 == 0:
        af[m] = True
        seta.add(b-1)
    if b-1 == N-1:
        bf[m] = True
        setb.add(a-1)
    if af[m] and bf[m]:
        ans = "POSSIBLE"
        break
    
for a in seta:
    if ans == "POSSIBLE":
        break
    if a in setb:
        ans = "POSSIBLE"
        break

print(ans)

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

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

ans = "IMPOSSIBLE"

seta,setb = set(),set()

for m in range(M):
    a,b = list(map(int,(input().split())))
    if a == 1:
        seta.add(b)
    if b == N:
        setb.add(a)
        
if seta & setb:
    print("POSSIBLE")
else:
    print("IMPOSSIBLE")
# Original solution
import fileinput

input = fileinput.input().readline

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

seta,setb = set(),set()

for m in range(M):
    a,b = list(map(int,(input().split())))
    if a == 1:
        seta.add(b)
    if b == N:
        setb.add(a)
        
if seta & setb:
    print("POSSIBLE")
else:
    print("IMPOSSIBLE")

# Optimized solution
import sys
lines = sys.stdin.readlines()
N,M = list(map(int,(lines[0].split())))
seta,setb = set(),set()
for m in range(1,M+1):
    a,b = list(map(int,(lines[m].split())))
    if a == 1:
        seta.add(b)
    if b == N:
        setb.add(a)        
if seta & setb:
    print("POSSIBLE")
else:
    print("IMPOSSIBLE")
# Original solution
n,m=list(map(int,input().split()))
g=[[] for _ in range(n+1)]
for i in range(m):
  a,b=list(map(int,input().split()))
  g[a].append(b)
  g[b].append(a)
flag=False
for i in g[1]:
  for j in g[i]:
    if j==n:
      flag=True
if flag==True:
  print('POSSIBLE')
else:
  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&s2)!=0:
  print('POSSIBLE')
else:
  print('IMPOSSIBLE')
# Original solution
import sys
from collections import Counter

# sys.stdin = open('c1.in')


def read_int_list():
    return list(map(int, input().split()))


def read_str_list():
    return input().split()


def read_int():
    return int(eval(input()))


def read_str():
    return eval(input())


n, m = read_int_list()
c = Counter()

for i in range(m):
    a, b = read_int_list()
    if a == 1:
        c[b] += 1
    if b == n:
        c[a] += 1

res = 'IMPOSSIBLE'
if 2 in list(c.values()):
    res = 'POSSIBLE'
print(res)


# Optimized solution
import sys
from collections import Counter


# sys.stdin = open('c1.in')


def read_int_list():
    return list(map(int, input().split()))


def read_str_list():
    return input().split()


def read_int():
    return int(eval(input()))


def read_str():
    return eval(input())


def solve():
    n, m = read_int_list()
    c = Counter()
    for i in range(m):
        a, b = read_int_list()
        if a == 1:
            c[b] += 1
        if b == n:
            c[a] += 1

    if 2 in list(c.values()):
        return 'POSSIBLE'
    return 'IMPOSSIBLE'


res = solve()
print(res)
# Original solution
from collections import deque

def solve(n, m, AB):
    g = [[] for _ in range(n)]
    for a, b in AB:
        g[a - 1].append(b - 1)
        g[b - 1].append(a - 1)

    q = deque(maxlen = n)
    q.append((0, 0))
    used = {0}
    while len(q) > 0:
        i, d = q.popleft()
        if d >= 2:
            break
        for c in g[i]:
            if c in used:
                continue
            if d == 1 and c == n - 1:
                return 'POSSIBLE'
            q.append((c, d + 1))
            used.add(c)
    return 'IMPOSSIBLE'

_n, _m = list(map(int, input().split()))
_AB = [list(map(int, input().split())) for _ in range(_m)]
print((solve(_n, _m, _AB)))


# Optimized solution
n, m = list(map(int, input().split()))
AB = [list(map(int, input().split())) for _ in range(m)]
cands = set(b if a == 1 else a for a, b in AB if a == 1 or b == 1)
if any(a in cands and b == n or b in cands and a == n for a, b in AB):
    print('POSSIBLE')
else:
    print('IMPOSSIBLE')
# Original solution
n, m = list(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])

for i in set(pot_starts):
    if i in pot_ends:
        print("POSSIBLE")
        exit()

print("IMPOSSIBLE")


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

# n, m = 3, 2
# a = [[1, 2], [2, 3]]

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(pot_ends):
    print("POSSIBLE")
else:
    print("IMPOSSIBLE")
# Original solution
N, M = [int(i) for i in input().split()]
ab = []

possible = False
for _ in range(M):
    ab.append([int(i) for i in input().split()])
    

c = []
e = []
for d in ab:
    if d[1] == N:
        c.append(d[0])
    elif d[0] == 1:
        e.append(d[1])

for f in e:
    if f in c:
        possible = True
        break

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

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

possible = False
for _ in range(M):
    ab.append([int(i) for i in input().split()])
    

c = []
e = []
for d in ab:
    if d[1] == N:
        c.append(d[0])
    elif d[0] == 1:
        e.append(d[1])

if len(set(c) & set(e)):
    print('POSSIBLE')
else:
    print('IMPOSSIBLE')
# Original solution
n,m = list(map(int,input().split()))
first = []
second = []
for i in range(m):
    a,b =  list(map(int,input().split()))
    if a == 1:
        first.append(b)
    if b == n:
        second.append(a)

for i in range(len(first)):
    if first[i] in second:
        print('POSSIBLE')
        exit()
else:
    print('IMPOSSIBLE')

# Optimized 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)
    if b == n:
        c.append(a)
        
if len(c) == len(set(c)):
    print('IMPOSSIBLE')
else:
    print('POSSIBLE')
# Original solution
N, M = list(map(int,input().split()))
AB = []
for m in range(M):
    a,b = list(map(int,input().split()))
    AB.append((a,b))

AB = sorted(AB)

first = []
for a,b in AB:
    if a == 1:
        first.append(b)
    else:
        break

AB = sorted(AB, key=lambda x:x[1], reverse=True)
sec = []
for a,b in AB:
    if b == N:
        sec.append(a)
    else:
        break

for f in first:
    if f in sec:
        print('POSSIBLE')
        exit()
print('IMPOSSIBLE')


# Optimized solution
import bisect

N, M = list(map(int,input().split()))
AB = []
for m in range(M):
    a,b = list(map(int,input().split()))
    AB.append((a,b))

AB = sorted(AB)

first = []
for a,b in AB:
    if a == 1:
        first.append(b)
    else:
        break

AB = sorted(AB, key=lambda x:x[1], reverse=True)
sec = []
for a,b in AB:
    if b == N:
        sec.append(a)
    else:
        break

if len(sec) >= 100:
    for f in first:
        ind = bisect.bisect_left(sec, f, 0, len(sec))
        if sec[ind] == f:
            print('POSSIBLE')
            exit()
else:
    for f in first:
        if f in sec:
            print('POSSIBLE')
            exit()

print('IMPOSSIBLE')
# Original solution
N,M = list(map(int,input().split()))
one_to = []
to_N = []
for _ in range(M):
    a,b = list(map(int,input().split()))
    if a == 1:
        one_to.append(b)
    if b == N:
        to_N.append(a)
one_to.sort()
to_N.sort()
ans = 0 
for i in one_to:
    count = 0
    for j in range(len(to_N)):
        if i == to_N[j]:
            ans = 1
            break
        if i > to_N[j]:
            count += 1
        if i < to_N[j]:
            break
    to_N = to_N[count:]
    if ans == 1:
        break
if ans == 0:
    print('IMPOSSIBLE')
else:
    print('POSSIBLE')

# Optimized solution
N,M = list(map(int,input().split()))
ans = 0
dic = {str(i):0 for i in range(1,N)}
for _ in range(M):
    a,b = list(map(int,input().split()))
    if a == 1:
        dic[str(b)] += 1
        if dic[str(b)] == 2:
            ans = 1
    if b == N:
        dic[str(a)] += 1
        if dic[str(a)] == 2:
            ans = 1
if ans == 0:
    print('IMPOSSIBLE')
else:
    print('POSSIBLE')
# Original solution
N, M = list(map(int,input().split()))
ABs = list([list(map(int,input().split())) for _ in range(M)])
 
ship1 =[]
shipn =[]
 
for ab in ABs:
    if ab[0]==1:ship1.append(ab[1])
    elif ab[1]==N:shipn.append(ab[0])

jdg=False      
      
for j in ship1:
    if j in shipn:jdg=True
if jdg:print('POSSIBLE')
else:print('IMPOSSIBLE')

# Optimized solution
import sys
input = sys.stdin.readline
N, M = list(map(int,input().split()))
ABs = list([list(map(int,input().split())) for _ in range(M)])
 
ship1 =[]
shipn =[]
 
for ab in ABs:
    if ab[0]==1:ship1.append(ab[1])
    elif ab[1]==N:shipn.append(ab[0])
 
      
if list(set(ship1) & set(shipn)) ==[]:print('IMPOSSIBLE')
else:print('POSSIBLE')
# Original solution
n, m = list(map(int, input().split()))
ab, c, d = [], [], []
for i in range(m):
    ab.append(list(map(int, input().split())))
for i in range(m):
    if(ab[i][0] == n):
        c.append(ab[i][1])
    elif(ab[i][1] == n):
        c.append(ab[i][0])
    elif(ab[i][0] == 1):
        d.append(ab[i][1])
    elif(ab[i][1] == 1):
        d.append(ab[i][0])
for i in c:
    if(i in d):
        print('POSSIBLE')
        exit()
print('IMPOSSIBLE')


# Optimized solution
n, m = list(map(int, input().split()))
ab, c, d = [], set(), set()
for i in range(m):
    ab.append(list(map(int, input().split())))
for i in range(m):
    if(ab[i][0] == n):
        c.add(ab[i][1])
    elif(ab[i][1] == n):
        c.add(ab[i][0])
    elif(ab[i][0] == 1):
        d.add(ab[i][1])
    elif(ab[i][1] == 1):
        d.add(ab[i][0])
if(c & d):
    print('POSSIBLE')
else:
    print('IMPOSSIBLE')
# Original solution
n, m = list(map(int, input().split()))
g = [[] for _ in range(n)]

for i in range(m):
  a, b = list(map(int, input().split()))
  a, b = a-1, b-1
  g[a].append(b)
  g[b].append(a)
  
from collections import deque
queue = deque([])
queue.append(0)

visited = [-1]*n
visited[0] = 0

while queue:
  x = queue.popleft()
  for new_x in g[x]:
    if visited[new_x] == -1:
      if new_x == n-1 and visited[x]+1 == 2:
        print('POSSIBLE')
        exit()
      else:
        visited[new_x] = visited[x]+1
        queue.append(new_x)
    else:
      continue
print('IMPOSSIBLE')

# Optimized solution
n, m = list(map(int, input().split()))
l1 = [0]*n
l2 = [0]*n

for i in range(m):
  a, b = list(map(int, input().split()))
  a, b = a-1, b-1
  if a == 0:
    l1[b] = 1
  elif b == n-1:
    l2[a] = 1
  else:
    continue

for j in range(n):
  if l1[j] == 1 and l2[j] == 1:
    print('POSSIBLE')
    exit()
else:
  print('IMPOSSIBLE')
# Original solution
n, m = list(map(int, input().split()))
l1 = [0]*n
l2 = [0]*n

for i in range(m):
  a, b = list(map(int, input().split()))
  a, b = a-1, b-1
  if a == 0:
    l1[b] = 1
  elif b == n-1:
    l2[a] = 1
  else:
    continue

for j in range(n):
  if l1[j] == 1 and l2[j] == 1:
    print('POSSIBLE')
    exit()
else:
  print('IMPOSSIBLE')
  


# Optimized solution
n, m = list(map(int, input().split()))
S = set()
for i in range(m):
    a, b = list(map(int, input().split()))
    a, b = a-1, b-1
    S.add((a, b))

for i in range(1, n-1):
    if (0, i) in S and (i, n-1) in S:
        print('POSSIBLE')
        exit()
else:
    print('IMPOSSIBLE')
# Original solution
n,m = list(map(int, input().split()))
ab = [[] for _ in range(n)]
for _ in range(m):
  a,b = [int(i)-1 for i in input().split()]
  ab[a].append(b)
  ab[b].append(a)

for i in ab[0]:
  if ab[i].count(n-1) >= 1:
    print("POSSIBLE")
    exit()
print("IMPOSSIBLE")

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

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

for i in ab[1]:
  for j in ab[i]:
    if j == n:
      print("POSSIBLE")
      exit()
print("IMPOSSIBLE")
# Original solution
n,m = list(map(int, input().split()))
lsta = []
lstb = []

for i in range(m):
    a,b = list(map(int, input().split()))
    if a==1:
        lsta.append(b)
    if b==n:
        lstb.append(a)

for i in lsta:
    if i in lstb:
        print("POSSIBLE")
        exit()
print("IMPOSSIBLE")


# Optimized solution
n,m = list(map(int, input().split()))
lsta = [0 for i in range(n+1)]
lstb = [0 for i in range(n+1)]

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

for i in range(n+1):
    if lsta[i]==1 and lstb[i]==1:
        print("POSSIBLE")
        exit()
print("IMPOSSIBLE")