CodeEff/ECCO huggingface dataset:
# Original solution
N, M = list(map(int, input().split()))

A = []
for i in range(M):
  A.append(list(map(int, input().split())))

D1 = [A[i][1] for i in range(M) if A[i][0] == 1]
D2 = [A[i][1] for i in range(M) if A[i][0] in D1]
if N in D2:
  print ("POSSIBLE")
else:
  print ("IMPOSSIBLE")

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

A = []
for i in range(M):
  A.append(list(map(int, input().split())))

D1 = set(A[i][1] for i in range(M) if A[i][0] == 1)
D2 = set(A[i][0] for i in range(M) if A[i][1] == N)

if len(D1 & D2) != 0:
  print ("POSSIBLE")
else:
  print ("IMPOSSIBLE")
# Original solution
n, m = list(map(int, input().split()))
a = [0] * m
b = [0] * m
for i in range(m):
    a[i], b[i] = list(map(int, input().split()))

first = []
second = []
for i in range(m):
    if a[i] == 1:
        first.append(b[i])

    if b[i] == n:
        second.append(a[i])
ans = 'IMPOSSIBLE'
for i in first:
    if i in second:
        ans = 'POSSIBLE'
print(ans)

# Optimized solution
n, m = list(map(int, input().split()))
a = [0] * m
b = [0] * m
first = set()
second = set()
for i in range(m):
    a[i], b[i] = list(map(int, input().split()))
    if a[i] == 1:
        first.add(b[i])
    if b[i] == n:
        second.add(a[i])


ans = 'IMPOSSIBLE'
if first & second:
    ans = 'POSSIBLE'
print(ans)
# Original solution
n,m = list(map(int,input().split()))
ab = [list(map(int,input().split()))for i in range(m)]
from1 = []
to_n = []
for i in range(m):
    if ab[i][0] == 1:
        from1.append(ab[i][1])
    if ab[i][1] == n:
        to_n.append(ab[i][0])

for i in range(len(from1)):
    if from1[i] in to_n:
        print('POSSIBLE')
        break
else:print('IMPOSSIBLE')


# Optimized solution
import sys
input = sys.stdin.readline
n,m = list(map(int,input().split()))
ab = [list(map(int,input().split()))for i in range(m)]
from1 = []
to_n = []
for i in range(m):
    if ab[i][0] == 1:
        from1.append(ab[i][1])
    if ab[i][1] == n:
        to_n.append(ab[i][0])
from1.sort()
to_n.sort()
'''
for i in range(len(from1)):
    if from1[i] in to_n:
        print('POSSIBLE')
        break
else:print('IMPOSSIBLE')
二分探索で実装できそう
'''
def bisearch(data,value):#data:ソート済みリスト  value:調べる値
  left = 0
  right = len(data) - 1
  while left <= right:
    mid = (left + right)//2
    if data[mid] == value:
      return mid
    elif data[mid] < value:
      left = mid + 1
    else:
      right = mid - 1
  return -1
for i in range(len(from1)):
    if bisearch(to_n,from1[i]) != -1:
        print('POSSIBLE')
        break
else:print('IMPOSSIBLE')
# Original solution
n,m = list(map(int,input().split()))
l = [list(map(int,input().split())) for i in range(m)]

a = []
b = []
for i in l:
    if i[0] == 1:
        a.append(i[1])
    if i[1] == n:
        b.append(i[0])

print(("POSSIBLE" if len(set(a)&set(b)) > 0 else "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_)
    if b_ == n:
        b.add(a_)
print(("POSSIBLE" if a&b else "IMPOSSIBLE"))
# Original solution
N,M = list(map(int,input().split()))
judge = 0 #0:不可,1:可

if(M >= 2):
 #N*N行列 島a~b間に定期便あり:1,なし:0
 island = []
 for i in range(N):
  island.append([0]*N)

 island1 = []
 for i in range(M):
  a,b = list(map(int,input().split()))
  a,b = a-1,b-1
  island[a][b] = 1
  island[b][a] = 1
  if(a == 0):
    island1.append(b)
  elif(b == 0):
    island1.append(b)

 for i in island1:
  if(island[i][N-1] == 1):#配列(リスト)の要素のアクセスO(1)
    judge = 1
    break
    
if(judge == 0):
  print('IMPOSSIBLE')
else:
  print('POSSIBLE')

# Optimized solution
N,M = list(map(int,input().split()))
judge = 0 #0:不可,1:可

if(M >= 2):
 #リスト 島1~a間に定期便あり:1,なし:0
 island1 = [0]*N
 #リスト 島b~N間に定期便あり:1,なし:0
 islandN = [0]*N

 for i in range(M):
  a,b = list(map(int,input().split()))
  a,b = a-1,b-1
  if(a == 0): island1[b] = 1
  if(b == 0): island1[a] = 1 
  if(a == N-1): islandN[b] = 1
  if(b == N-1): islandN[a] = 1
    
 for i in range(len(island1)):
  if((island1[i] == 1)and(islandN[i] == 1)):
    judge = 1
    break
    
if(judge == 0):
  print('IMPOSSIBLE')
else:
  print('POSSIBLE')
# Original solution
from collections import deque
N, M = list(map(int, input().split()))
left = deque([])
right = deque([])
for i in range(M):
  a, b = list(map(int, input().split()))
  if a == 1:
    left.append(b)
  elif b == N:
    right.append(a)
    
flag = False
for r in right:
  if r in left:
    flag = True
    break
    
if flag:
  print('POSSIBLE')
else:
  print('IMPOSSIBLE')


# Optimized solution
N, M = list(map(int, input().split()))
left = []
right = []
for i in range(M):
  a, b = list(map(int, input().split()))
  if a == 1:
    left.append(b)
  elif b == N:
    right.append(a)
    
flag = False
left = set(left)
for r in right:
  if r in left:
    flag = True
    break
    
if flag:
  print('POSSIBLE')
else:
  print('IMPOSSIBLE')
# Original solution
# https://atcoder.jp/contests/abc068/tasks/arc079_a

import itertools
from collections import Counter
from collections import defaultdict
import bisect

def main():
    N, M = list(map(int, input().split()))
    s_list = []
    g_list = []

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

    for s in s_list:
        if s in g_list:
            print("POSSIBLE")
            exit()
    print("IMPOSSIBLE")


if __name__ == '__main__':
    main()


# Optimized solution
# https://atcoder.jp/contests/abc068/tasks/arc079_a

import itertools
import collections
import bisect

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

    src = {}
    A = []
    B = []
    for _ in range(M):
        a, b = list(map(int, input().split()))
        A.append(a)
        B.append(b)

        if a == 1:
            src[b] = 1

    for i in range(M):
        if A[i] in src and B[i] == N:
            print("POSSIBLE")
            exit()

    print("IMPOSSIBLE")


if __name__ == '__main__':
    main()
# Original solution
N,M = list(map(int,input().split()))
a_list=[]
pass_1= []
for i in range(M):
    a = list(map(int,input().split()))
    if(a[0]==1):
        pass_1.append(a[1])
    if(a[1]==N):
        a_list.append(a)
    
for j in pass_1:
    if([j,N] in a_list):
        print("POSSIBLE")
        exit()
print("IMPOSSIBLE")

# Optimized solution
N,M = list(map(int,input().split()))
a_list=[]
pass_1= []
for i in range(M):
    a = list(map(int,input().split()))
    if(a[0]==1):
        pass_1.append(a[1])
    elif(a[1]==N):
        a_list.append(a[0])
    
if list(set(pass_1) & set(a_list)):
    print('POSSIBLE')
else:
    print('IMPOSSIBLE')
# Original solution

n,m = list(map(int,input().split()))
A = [[int(i) for i in input().split()] for j in range(m)]
B = []
C = []
for i in A:
    if 1 in i:
        B += i

for i in A:
    a,b = i
    if a in B:
        C.append(b)
    elif b in B:
        C.append(a)
        


if n in C or n in B:
    print('POSSIBLE')
else:
    print('IMPOSSIBLE')
    

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

if n in C or n in B:
    print('POSSIBLE')
else:
    print('IMPOSSIBLE')
# Original solution
from collections import deque

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

edges = [[] for _ in range(N)]

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

def dfs(start, end):
    minDist = [-1 for _ in range(N)]
    minDist[start] = 0

    que = deque([])
    que.append((start, 0))

    while que:
        now, dist = que.popleft()

        minDist[now] = dist
        if now == end:
            return dist

        for to in edges[now]:
            if minDist[to] >= 0:
                continue
            que.append((to, dist + 1))

    return float('inf')

if dfs(0, N - 1) <= 2:
    print('POSSIBLE')
else:
    print('IMPOSSIBLE')

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

edges =[set() for _ in range(N + 1)]
one = set()
for _ in range(M):
    fr, to = list(map(int, input().split()))
    edges[fr].add(to)
    edges[to].add(fr)
    if fr == 1:
        one.add(to)
    if to == 1:
        one.add(fr)

for fr in one:
    if N in edges[fr]:
        print('POSSIBLE')
        exit()

print('IMPOSSIBLE')
# Original solution
def Dijkstra(N, edges, s):
    from heapq import heappush, heappop, heapify
    dist = [10**20 for _ in range(N)]
    dist[s], h = 0, [[0, s]]
    while (len(h)):
        p = heappop(h)
        d, v = p[0], p[1]
        if d > dist[v]:
            continue
        for i in range(len(edges[v])):
            u = edges[v][i]
            if d + 1 < dist[u]:
                dist[u] = d + 1
                heappush(h, [dist[u], u])
    return dist

N, M = list(map(int, input().split()))
es = [[] for _ in range(N)]
for _ in range(M):
    a, b = [int(x) - 1 for x in input().split()]
    es[a].append(b)
    es[b].append(a)
dist = Dijkstra(N, es, 0)
if dist[N - 1] == 2:
    print('POSSIBLE')
else:
    print('IMPOSSIBLE')

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

def Dijkstra(N, edges, s):
    from heapq import heappush, heappop, heapify
    dist = [10**18 for _ in range(N)]
    dist[s], h = 0, [[0, s]]
    while (len(h)):
        p = heappop(h)
        d, v = p[0], p[1]
        if d > dist[v]:
            continue
        for i in range(len(edges[v])):
            u = edges[v][i]
            if d + 1 < dist[u]:
                dist[u] = d + 1
                heappush(h, [dist[u], u])
    return dist

N, M = list(map(int, input().split()))
es = [[] for _ in range(N)]
for _ in range(M):
    a, b = [int(x) - 1 for x in input().split()]
    es[a].append(b)
    es[b].append(a)
dist = Dijkstra(N, es, 0)
if dist[N - 1] == 2:
    print('POSSIBLE')
else:
    print('IMPOSSIBLE')
# Original solution
import sys


inint = lambda: int(sys.stdin.readline())
inintm = lambda: list(map(int, sys.stdin.readline().split()))
inintl = lambda: list(inintm())
instrm = lambda: list(map(str, sys.stdin.readline().split()))
instrl = lambda: list(instrm())

n, m = inintm()

t = []

for _ in range(m):
    a, b = inintm()
    if a == 1:
        if b in t:
            print("POSSIBLE")
            exit()
        t.append(b)
    elif b == n:
        if a in t:
            print("POSSIBLE")
            exit()
        t.append(a)

print("IMPOSSIBLE")


# Optimized solution
import sys


inint = lambda: int(sys.stdin.readline())
inintm = lambda: list(map(int, sys.stdin.readline().split()))
inintl = lambda: list(inintm())
instrm = lambda: list(map(str, sys.stdin.readline().split()))
instrl = lambda: list(instrm())

n, m = inintm()

t = [0]*(n+1)

for _ in range(m):
    a, b = inintm()
    if a == 1:
        if t[b] == 1:
            print("POSSIBLE")
            exit()
        t[b] = 1
    elif b == n:
        if t[a] == 1:
            print("POSSIBLE")
            exit()
        t[a] = 1

print("IMPOSSIBLE")
# Original solution
n,m = list(map(int, input().split()))
a = [0] * m
b = [0] * m
for i in range(m):
    a[i],b[i] = list(map(int,input().split()))
c = []
d = []
for i in range(m):
    
    if a[i] == 1:
        c.append(b[i])
    if b[i] == n:
        d.append(a[i])
ans = False
c = list(set(c))
for i in c:
    if d.count(i) >=1:
        ans = True
        break
if ans:
    print('POSSIBLE')
else:
    print('IMPOSSIBLE')

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

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

go = []
goal = []

for i in range(len(a)):
    if a[i] == 1:
        go.append(b[i])
    if b[i] == n:
        goal.append(a[i])

count = [0 for i in range(n)]
for i in range(len(go)):
    count[go[i]-1] = 1
for i in range(len(goal)):
    count[goal[i]-1] += 1
for i in range(len(count)):
    if count[i] > 1:
        print("POSSIBLE")
        exit()
print("IMPOSSIBLE")
# Original solution
from sys import stdin
N,M = [int(x) for x in stdin.readline().rstrip().split()]
data = []
for _ in range(M):
    data.append([int(x) for x in stdin.readline().rstrip().split()])
shima = []

flag = False
for i in sorted(data):
    if i[0] == 1:
        shima.append(i[1])
    if (i[1] == N) and (i[0] in shima):
        flag = True
        break

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

# Optimized solution
from sys import stdin
N,M = [int(x) for x in stdin.readline().rstrip().split()]
data = []
for _ in range(M):
    data.append([int(x) for x in stdin.readline().rstrip().split()])
shima = set()

flag = False
for i in sorted(data):
    if i[0] == 1:
        shima.add(i[1])
    if (i[1] == N) and (i[0] in shima):
        flag = True
        break

if flag:
    print("POSSIBLE")
else:
    print("IMPOSSIBLE")
# Original solution
N, M = list(map(int, input().split()))
s = []
e = []
for i in range(M):
  a, b = list(map(int, input().split()))
  if a == 1:
    s.append(b)
  if b == N:
    e.append(a)
ans = 'IMPOSSIBLE'
for k in s:
  if k in e:
    ans = 'POSSIBLE'
    break
print(ans)

# Optimized solution
N, M = list(map(int, input().split()))
s = []
e = []
for i in range(M):
  a, b = list(map(int, input().split()))
  if a == 1:
    s.append(b)
  if b == N:
    e.append(a)
if set(s) & set(e):
  print('POSSIBLE')
else:
  print('IMPOSSIBLE')
# Original solution
from collections import deque
N, M = [int(x) for x in input().split()]
fst_to = deque([])
sec_from = deque([])
for a, b in [[int(x) for x in input().split()] for _ in range(M)]:
  if a == 1:
    fst_to.append(b)
  elif b == N:
    sec_from.append(a)
ret = 'IMPOSSIBLE'
for a in fst_to:
  if a in sec_from:
    ret = 'POSSIBLE'
    break
print(ret)

# Optimized solution
from collections import deque
N, M = [int(x) for x in input().split()]
fst_to = deque([])
sec_from = deque([])
for a, b in [[int(x) for x in input().split()] for _ in range(M)]:
  if a == 1:
    fst_to.append(b)
  elif b == N:
    sec_from.append(a)
ret = 'IMPOSSIBLE'
if set(fst_to) & set(sec_from):
  ret = 'POSSIBLE'
print(ret)
# Original solution
n, m = list(map(int,input().split()))
ab = [[] for _ in range(n+2)]

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

if any((i in ab[n]) for i in ab[1]):
    print("POSSIBLE")
else:
    print("IMPOSSIBLE")

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

for _ in range(m):
    a, b = list(map(int, input().split()))
    if a==1:
        ab[b] += 1
        continue
    elif b == n:
        ab[a] += 1
        continue
if max(ab) == 2:
    print("POSSIBLE")
else:
    print("IMPOSSIBLE")
# Original solution
# -*- coding: utf-8 -*-

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

for s in start:
    for f in finish:
        if s == f:
            print('POSSIBLE')
            exit()

print('IMPOSSIBLE')


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

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

if set(start) & set(finish):
    print('POSSIBLE')
else:
    print('IMPOSSIBLE')
# Original solution
N,M=list(map(int,input().split()))
a=[]
b=[]
e=[]
f=[]
g=0
for i in range(M):
    c,d = list(map(int,input().split()))
    a.append(c)
    b.append(d)
for j in range(M):
    if b[j]!=N:
        if a[j]!=1:
            pass
        else:
            e.append(b[j])
    else:
        f.append(a[j])
if (len(e)==0) or (len(f)==0):
    print('IMPOSSIBLE')
else:
    for l in range(len(e)):
      if e[l] in f:
        g += 1
        break
      else:
        pass
    if g>0:
      print('POSSIBLE')
    else:
      print('IMPOSSIBLE')

# Optimized solution
N,M=list(map(int,input().split()))
island=[[] for i in range(N)]
for j in range(M):
    c,d=list(map(int,input().split()))
    island[d-1].append(c)
    island[c-1].append(d)
f = 0
for k in range(N):
    if 1 in island[k]:
        if N in island[k]:
            f += 1
            break
        else:
            pass
    else:
        pass
if f>0:
    print('POSSIBLE')
else:
    print('IMPOSSIBLE')
# Original solution
#!/usr/bin/env python3

import sys
sys.setrecursionlimit(10**9)

# from numba import njit

# from collections import Counter
# from itertools import accumulate
# import numpy as np
# from heapq import heappop,heappush
# from bisect import bisect_left

# @njit
def solve(n,m,l):
  edges = {i+1:[] for i in range(n)}
  for i in range(m):
    a,b = l[i]
    edges[a].append(b)
    edges[b].append(a)
  def dfs(start,end,rest):
    if rest == 0:
      return start == end
    else:
      return any(dfs(nextNode,end,rest-1) for nextNode in edges[start])

  return dfs(1,n,2)



def main():
  N,M = list(map(int,input().split()))
  l = [tuple(map(int,input().split())) for _ in range(M)]
  print(("POSSIBLE" if solve(N,M,l) else "IMPOSSIBLE"))
  return

if __name__ == '__main__':
  main()


# Optimized solution
#!/usr/bin/env python3

import sys
sys.setrecursionlimit(10**9)

# from numba import njit

# from collections import Counter
# from itertools import accumulate
# import numpy as np
# from heapq import heappop,heappush
# from bisect import bisect_left

# @njit
def solve(n,m,l):
  edges = {i+1:[] for i in range(n)}
  for i in range(m):
    a,b = l[i]
    edges[a].append(b)
    edges[b].append(a)
  return any(1 in v and n in v for k,v in list(edges.items()))



def main():
  N,M = list(map(int,input().split()))
  l = [tuple(map(int,input().split())) for _ in range(M)]
  print(("POSSIBLE" if solve(N,M,l) else "IMPOSSIBLE"))
  return

if __name__ == '__main__':
  main()
# Original solution
import bisect
N, M = list(map(int, input().split()))
a = [None for i in range(2 * M)]
flag = 0
for i in range(M):
    A, B = list(map(int, input().split()))
    a[2*i] = [A, B]
    a[2*i+1] = [B, A]

a.sort()
b = a[:]
b.reverse()
one = []
two = []
for i in range(M):
    if a[i][0] == 1:
        one.append(a[i][1])
    else:
        break

for i in range(M):
    if b[i][0] == N:
        two.append(b[i][1])
    else:
        break

for i in range(len(one)):
    for j in range(len(two)):
        if one[i] == two[j]:
            flag = 1
            print("POSSIBLE")
            break

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


# Optimized solution
import sys

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

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

flag = 0
for i in ship[1]:
    if N in ship[i]:
        flag = 1
if flag == 1:
    print("POSSIBLE")
else:
    print("IMPOSSIBLE")
# Original solution
import sys

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

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

flag = 0
for i in ship[1]:
    if N in ship[i]:
        flag = 1
if flag == 1:
    print("POSSIBLE")
else:
    print("IMPOSSIBLE")


# Optimized solution
import sys
input = sys.stdin.readline
N, M = list(map(int, input().split()))
ship = [[] for i in range(N+1)]

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

flag = 0
for i in ship[1]:
    if N in ship[i]:
        flag = 1
if flag == 1:
    print("POSSIBLE")
else:
    print("IMPOSSIBLE")
# Original solution
from collections import defaultdict
from heapq import heappop, heappush


class Graph(object):
    """
    隣接リストによる有向グラフ
    """

    def __init__(self):
        self.graph = defaultdict(list)

    def __len__(self):
        return len(self.graph)

    def add_edge(self, src, dst, weight=1):
        self.graph[src].append((dst, weight))

    def get_nodes(self):
        return list(self.graph.keys())


class Dijkstra(object):
    """
    ダイクストラ法（二分ヒープ）による最短経路探索
    計算量: O((E+V)logV)
    """

    def __init__(self, graph, start):
        self.g = graph.graph

        # startノードからの最短距離
        # startノードは0, それ以外は無限大で初期化
        self.dist = defaultdict(lambda: float('inf'))
        self.dist[start] = 0

        # 最短経路での1つ前のノード
        self.prev = defaultdict(lambda: None)

        # startノードをキューに入れる
        self.Q = []
        heappush(self.Q, (self.dist[start], start))

        while self.Q:
            # 優先度（距離）が最小であるキューを取り出す
            dist_u, u = heappop(self.Q)
            if self.dist[u] < dist_u:
                continue
            for v, weight in self.g[u]:
                alt = dist_u + weight
                if self.dist[v] > alt:
                    self.dist[v] = alt
                    self.prev[v] = u
                    heappush(self.Q, (alt, v))

    def shortest_distance(self, goal):
        """
        startノードからgoalノードまでの最短距離
        """
        return self.dist[goal]

    def shortest_path(self, goal):
        """
        startノードからgoalノードまでの最短経路
        """
        path = []
        node = goal
        while node is not None:
            path.append(node)
            node = self.prev[node]
        return path[::-1]


if __name__ == "__main__":
    n, m = list(map(int, input().split()))

    g1 = Graph()

    for i in range(m):
        a, b = list(map(int, input().split()))
        g1.add_edge(a-1, b-1)
        g1.add_edge(b-1, a-1)

    d = Dijkstra(g1, 0)

    if d.dist[n-1] == 2:
        print('POSSIBLE')
    else:
        print('IMPOSSIBLE')


# Optimized solution
from collections import defaultdict


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

    g = defaultdict(list)

    for n in ab:
        g[n[0]].append(n[1])

    if 1 not in g:
        print('IMPOSSIBLE')
        exit()

    for i in g[1]:
        if i not in g:
            continue
        for j in g[i]:
            if j == N:
                print('POSSIBLE')
                exit()

    print('IMPOSSIBLE')


if __name__ == "__main__":
    main()
# Original solution
N,M=list(map(int,input().split()))
a=[]
b=[]
for i in range(M):
    c,d=list(map(int,input().split()))
    if c==1:
        a.append(d)
    if d==N:
        b.append(c)

#O(M)

flag = False
for idx in a:
    if idx in b:
        print("POSSIBLE")
        exit()

print("IMPOSSIBLE")

# Optimized solution
N,M=list(map(int,input().split()))
G = [list() for i in range(N+1)]
for i in range(M):
    a,b=list(map(int,input().split()))
    G[a].append(b)
    G[b].append(a)
#O(M)
flag = False
for i in G[1]:
    if N in G[i]:
        flag = True
        break

if flag:
    print("POSSIBLE")
else:
    print("IMPOSSIBLE")
# Original solution
N, M = list(map(int, input().split()))
ab_list = sorted([list(map(int, input().split())) for _ in range(M)])

ans = "IMPOSSIBLE"
second_island = []

for a, b in ab_list:
  if a == 1:
    second_island.append(b)

  if b == N:
    if a in second_island:
      ans = "POSSIBLE"
      break

print(ans)

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

print(('POSSIBLE' if len(sa&sb) != 0 else 'IMPOSSIBLE'))
# Original solution
import sys
n, m = list(map(int, input().split()))
p = [list(map(int, input().split())) for _ in range(m)]
ln1 = []
ln2 = []
for i in p:
    if i[0] == 1:
        ln1.append(i[1])
for j in p:
    if j[1] == n:
        ln2.append(j[0])

for k in ln1:
    if k in ln2:
        print('POSSIBLE')
        sys.exit()
print('IMPOSSIBLE')

# Optimized solution
import sys
n, m = list(map(int, input().split()))
p = [list(map(int, input().split())) for _ in range(m)]
ln1 = []
ln2 = []
for i in p:
    if i[0] == 1:
        ln1.append(i[1])
for j in p:
    if j[1] == n:
        ln2.append(j[0])

if len(set(ln1) & set(ln2)) == 0:
    print('IMPOSSIBLE')
else:
    print('POSSIBLE')