CodeEff/ECCO huggingface dataset:
# Original solution
# グラフわからんのでグラフアルゴリズム忘れた
# dfsでやる 限度2回

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


def dfs(t, c, used):
    if c != 0 and t == n - 1:
        return True
    if c == 0:
        return False
    flag = False
    for g in graph[t]:
        if g in used:
            continue
        next_used = used[:]
        next_used.append(g)
        flag = dfs(g, c - 1, next_used)
        if flag:
            break
    return flag


for x in graph[0]:
    if dfs(x, 2, [x]):
        print("POSSIBLE")
        exit()
print("IMPOSSIBLE")


# Optimized solution
# グラフわからんのでグラフアルゴリズム忘れた
# dfsでやる 限度2回c
# なんかしらんけどdfsが2TLEになるので諦めた それぞれの島について1とNがあれば良い

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

for g in graph[1 : n - 1]:
    c = 0
    for v in g:
        if c >= 2:
            break
        if v == 0 or v == n - 1:
            c += 1
    if c == 2:
        print("POSSIBLE")
        exit()
print("IMPOSSIBLE")
# Original solution
n,m = list(map(int,input().split()))
A = set()
B = set()
for _ in range(m):
    x = list(map(int,input().split()))
    if x[0]==1:
        A = A|set(x)
    elif x[1]==n:
        B = B|set(x)
if len(A&B)>0:
    print("POSSIBLE")
else:
    print("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:sb.add(b)
    if b==N:sa.add(a)
print(("IMPOSSIBLE" if len(sa&sb)==0 else "POSSIBLE"))
# Original solution
# -*- coding: utf-8 -*-

import math

N, M = list(map(int, input().split()))
start = []
goal = []
for i in range(M):
    l1, l2 = list(map(int, input().split()))
    if (l1 == 1):
        start.append([l1, l2])
    if (l2 == N):
        goal.append([l1, l2])

def check(st, go):
    for i in st:
        if ([i[1], N] in go):
            return(True)
    return(False)

if (check(start, goal)):
    print('POSSIBLE')
else:
    print('IMPOSSIBLE')


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

import math

N, M = list(map(int, input().split()))
start = [False] * N
goal = [False] * N
for i in range(M):
    a1, a2 = list(map(int, input().split()))
    if (a1 == 1):
        start[a2 - 1] = True
    if (a2 == N):
        goal[a1 - 1] = True

def check():
    for i in range(N):
        if (start[i] & goal[i]):
            return('POSSIBLE')
    return('IMPOSSIBLE')

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

s=[]
g=[]
for i, j in ab:
    if i==1:
        s.append(j)
    elif j==1:
        s.append(i)
    elif i==N:
        g.append(j)
    elif j==N:
        g.append(i)
flag=0
for i in range(len(s)):
    if s[i] in g:
        flag=1
        break

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


# Optimized solution
N, M=list(map(int, input().split()))
ab=[list(map(int, input().split())) for _ in range(M)]
b=set()
for i,j in ab:
    if i==1 or j==N:
        b.add((i,j))
print(("IM"*(not(any(((1,i) in b and (i,N) in b) for i in range(N))))+"POSSIBLE"))
# Original solution
n,m = list(map(int,input().split()))
a = []
b = []
ans = ""
for i in range(m):
    tmp1,tmp2 = list(map(int,input().split()))
    a.append(tmp1)
    b.append(tmp2)

xton = []
#nへ向かう便が出てる島を確認する
for i in range(m):
    if b[i] == n:
        xton.append(a[i])
#nへ向かう便が出ている島へ1から向かう便があるか確認する
for i in range(m):
    if a[i] == 1 and b[i] in xton:
        ans = "POSSIBLE"
        break
    else:
        ans = "IMPOSSIBLE"
print(ans)

# Optimized solution
n,m = list(map(int,input().split()))
a = []
b = []
ans = ""
for i in range(m):
    tmp1,tmp2 = list(map(int,input().split()))
    a.append(tmp1)
    b.append(tmp2)

xton = set()
#nへ向かう便が出てる島を確認する
for i in range(m):
    if b[i] == n:
        xton.add(a[i])
#nへ向かう便が出ている島へ1から向かう便があるか確認する
for i in range(m):
    if a[i] == 1 and b[i] in xton:
        ans = "POSSIBLE"
        break
    else:
        ans = "IMPOSSIBLE"
print(ans)
# Original solution
def main():
    n, m = list(map(int, input().split()))
    a, b = [], []
    to_n = []
    for _ in range(m):
        x, y = list(map(int, input().split()))
        a.append(x)
        b.append(y)
        if y == n:
            to_n.append(x)

    for j in range(m):
        if a[j] == 1:
            if b[j] in to_n:
                return 'POSSIBLE'
    return 'IMPOSSIBLE'


print((main()))

# Optimized solution
def main():
    n, m = list(map(int, input().split()))
    a, b = [], []
    from_1 = set()
    to_n = set()
    for _ in range(m):
        x, y = list(map(int, input().split()))
        if x == 1:
            from_1.add(y)
            continue
        if y == n:
            to_n.add(x)
            continue
    ans = from_1 & to_n
    if ans:
        return "POSSIBLE"

    return 'IMPOSSIBLE'


print((main()))
# Original solution
import sys

n, m = list(map(int, input().split()))
a_list1 = []
b_list1 = []
a_list2 = []
b_list2 = []

for i in range(m):
    a, b = list(map(int, input().split()))
    if a == 1:
        a_list1.append(a)
        b_list1.append(b)
    elif b == n:
        a_list2.append(a)
        b_list2.append(b)

for i in range(len(a_list1)):
    for j in range(len(a_list2)):
        if b_list1[i] == a_list2[j]:
            print('POSSIBLE')
            sys.exit()

print('IMPOSSIBLE')


# Optimized solution
import sys

n, m = list(map(int, input().split()))
mid_set1 = set([])
mid_set2 = set([])

for i in range(m):
    a, b = list(map(int, input().split()))
    if a == 1:
        mid_set1.add(b)
    elif b == n:
        mid_set2.add(a)

if len(mid_set1&mid_set2) > 0:
    print('POSSIBLE')
    sys.exit()
print('IMPOSSIBLE')
# Original solution
N, M = list(map(int, input().split()))
ab = [list(map(int, input().split())) for i in range(M)]
second = []
flag = False
for x in range(M):
    if ab[x][0] == 1:
        second.append(ab[x][1])

for y in range(len(second)):
    for z in range(M):
        if ab[z][0] == second[y] and ab[z][1] == N:
            flag = True
if flag:
    print("POSSIBLE")
else:
    print("IMPOSSIBLE")


# Optimized solution
N, M = list(map(int, input().split()))
ab = [list(map(int, input().split())) for i in range(M)]
start = []
goal = []
flag = False
for x in range(M):
    if ab[x][0] == 1:
        start.append(ab[x][1])

    if ab[x][1] == N:
        goal.append(ab[x][0])

start_goal = set(start) & set(goal)

if start_goal:
    print("POSSIBLE")
else:
    print("IMPOSSIBLE")
# Original solution
def takahasi(n , m , a):

    ans = "IMPOSSIBLE"
    list1 = []
    listn = []

    for i in range(m):
        if a[i][0] == 1:
            list1.append(a[i][1])
        elif a[i][1] == n:
            listn.append(a[i][0])
    
    for i in range(len(list1)):
        if listn.count(list1[i]) != 0:
            ans = "POSSIBLE"

    return ans

def main():
    n , m = list(map(int , input().split()))
    a = [list(map(int,input().split())) for i in range(m)]
    print((takahasi(n , m , a)))

if __name__ == '__main__':
    main()

# Optimized solution
def takahasi(n , m , a):

    ans = "IMPOSSIBLE"
    list1n = []

    for i in range(m):
        if a[i][0] == 1 or a[i][1] == n:
            list1n.append(a[i][1] if a[i][0] == 1 else a[i][0])

    if len(list1n) != len(set(list1n)):
        ans = "POSSIBLE"

    return ans

def main():
    n , m = list(map(int , input().split()))
    a = [list(map(int,input().split())) for i in range(m)]
    print((takahasi(n , m , a)))

if __name__ == '__main__':
    main()
# Original solution
import sys
import heapq

sys.setrecursionlimit(10 ** 7)
f_inf = float('inf')
mod = 10 ** 9 + 7


def resolve():
    n, m = list(map(int, input().split()))

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

    # ダイクストラ法：O(ElogV)
    def dijkstra_heap(s):
        # 始点sから各頂点への最短距離
        d = [float("inf")] * n
        used = [True] * n  # True:未確定
        d[s] = 0
        used[s] = False
        edgelist = []
        for e in edge[s]:
            heapq.heappush(edgelist, e)
        while len(edgelist):
            minedge = heapq.heappop(edgelist)
            # まだ使われてない頂点の中から最小の距離のものを探す
            if not used[minedge[1]]:
                continue
            v = minedge[1]
            d[v] = minedge[0]
            used[v] = False
            for e in edge[v]:
                if used[e[1]]:
                    heapq.heappush(edgelist, [e[0] + d[v], e[1]])
        return d

    L = dijkstra_heap(n - 1)

    if L[0] <= 2:
        print("POSSIBLE")
    else:
        print("IMPOSSIBLE")


if __name__ == '__main__':
    resolve()


# Optimized solution
# https://atcoder.jp/contests/abc068/submissions/12987221
# C - Cat Snuke and a Voyage
import sys

sys.setrecursionlimit(10 ** 7)
f_inf = float('inf')
mod = 10 ** 9 + 7


def resolve():
    n, m = list(map(int, input().split()))

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

    for i in edge[0]:
        if n - 1 in set(edge[i]):
            print("POSSIBLE")
            break
    else:
        print("IMPOSSIBLE")


if __name__ == '__main__':
    resolve()
# Original solution
N, M = list(map(int, input().split()))

atb  = [list(map(int, input().split())) for _ in range(M)]

flg  = 0
#愚直にやる
for i in range(2, N, 1):

    #定期便ある?
    if [1, i] in atb:
        if [i, N] in atb:
            print("POSSIBLE")
            flg = 1
if flg==0:
    print("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)
    elif b==N:
        sb.add(a)

print(("POSSIBLE" if len(sa&sb)!=0 else "IMPOSSIBLE"))
# Original solution
# -*- coding: utf-8 -*-
import itertools
import sys

ships = []
N, M = [int(x) for x in input().split()]
for i in range(M):
    ships.append([int(x) for x in input().split()])

from_1 = [ship[1] for ship in ships if ship[0] == 1]
to_N = [ship[0] for ship in ships if ship[1] == N]

for land in from_1:
    if land in to_N:
        print("POSSIBLE")
        sys.exit()

print("IMPOSSIBLE")

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

ships = []
N, M = [int(x) for x in input().split()]
for i in range(M):
    ships.append([int(x) for x in input().split()])

from_1 = set([ship[1] for ship in ships if ship[0] == 1])
to_N = set([ship[0] for ship in ships if ship[1] == N])

if from_1.intersection(to_N):
    print("POSSIBLE")
else:
    print("IMPOSSIBLE")
# Original solution
from collections import Counter
from functools import reduce
# import statistics
import bisect
import copy
import fractions
import math
import pprint
import random
import sys
import time
sys.setrecursionlimit(10**7)
INF = 10 ** 18
MOD = 10 ** 9 + 7
def LI(): return [int(x) for x in sys.stdin.readline().split()]
def LF(): return [float(x) for x in sys.stdin.readline().split()]
def LS(): return sys.stdin.readline().split()
def MI(): return list(map(int, sys.stdin.readline().split()))
def II(): return int(sys.stdin.readline())
def IS(): return eval(input())
def C(x): return Counter(x)
def GCD_LIST(numbers):
    return reduce(fractions.gcd, numbers)
def LCM_LIST(numbers):
    return reduce(LCM, numbers)
def LCM(m, n):
    return (m * n // fractions.gcd(m, n))
def unite(x, y):
    # それぞれのノードの根を求める
    x = root(x)
    y = root(y)
    if x == y:
        return
    # node[x]の根をyに変更する
    node[x] = y
def same(x,y): return bool(root(x) == root(y))
def root(x):
    if node[x] == x:  # xが根の場合
        return x
    else:
        node[x] = root(node[x])  # 経路圧縮
        return node[x]
def dfs(v,depth):
    # ノードに訪れた
    visited[v] = 1
    if depth == 2:
        return
    for a, b in sides:
        if v == a-1:
            depth += 1
            dfs(b-1, depth)
            depth -= 1

n, m = MI()
sides = [LI() for _ in range(m)]
islands = [[0] * 2 for _ in range(n)]

for a, b in sides:
    if a-1 == 0:
        islands[b-1][0] = 1
    if b-1 == n-1:
        islands[a-1][1] = 1

for a, b in islands:
    if a == b == 1:
        print('POSSIBLE')
        exit()
print('IMPOSSIBLE')


# Optimized solution
from collections import Counter
from functools import reduce
# import statistics
import bisect
import copy
import fractions
import math
import pprint
import random
import sys
import time
sys.setrecursionlimit(10**7)
INF = 10 ** 18
MOD = 10 ** 9 + 7
def LI(): return [int(x) for x in sys.stdin.readline().split()]
def LF(): return [float(x) for x in sys.stdin.readline().split()]
def LS(): return sys.stdin.readline().split()
def MI(): return list(map(int, sys.stdin.readline().split()))
def II(): return int(sys.stdin.readline())
def IS(): return eval(input())
def C(x): return Counter(x)
def GCD_LIST(numbers):
    return reduce(fractions.gcd, numbers)
def LCM_LIST(numbers):
    return reduce(LCM, numbers)
def LCM(m, n):
    return (m * n // fractions.gcd(m, n))
def unite(x, y):
    # それぞれのノードの根を求める
    x = root(x)
    y = root(y)
    if x == y:
        return
    # node[x]の根をyに変更する
    node[x] = y
def same(x,y): return bool(root(x) == root(y))
def root(x):
    if node[x] == x:  # xが根の場合
        return x
    else:
        node[x] = root(node[x])  # 経路圧縮
        return node[x]
def dfs(v,depth):
    # ノードに訪れた
    visited[v] = 1
    if depth == 2:
        return
    for a, b in sides:
        if v == a-1:
            depth += 1
            dfs(b-1, depth)
            depth -= 1

n, m = MI()
a, b = set(), set()
for i in range(m):
    x, y = MI()
    if x == 1:
        a.add(y)
    if y == n:
        b.add(x)

print(("POSSIBLE" if a&b else "IMPOSSIBLE"))
# Original solution
from collections import defaultdict
N,M=list(map(int,input().split()))
dict=defaultdict(int)
l1=[]
l2=[]
for i in range(M):
    a,b=list(map(int,input().split()))
    if a==1:
        l1.append(b)
    if b==N:
        dict[a]=1
for i in l1:
    if dict[i]:
        print("POSSIBLE")
        quit()
print("IMPOSSIBLE")


# Optimized solution

N,M=list(map(int,input().split()))
t=set()
s=set()
for i in range(M):
    a,b=list(map(int,input().split()))
    if a==1:
        s.add(b)
    if b==N:
        t.add(a)
for i in s:
    if i in t:
        print("POSSIBLE")
        quit()
print("IMPOSSIBLE")
# Original solution
N,M = list(map(int,input().split()))

goto_N = [0]*N
from_1 = [0]*N

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

for i in range(N):
    if goto_N[i] and from_1[i]:
        print("POSSIBLE")
        exit()

print("IMPOSSIBLE")

# Optimized solution
N,M = list(map(int,input().split()))
##1からきている&&Nに行ける

road = [0]*N

for _ in range(M):
    a,b = list(map(int,input().split()))

    if a == 1:
        road[b-1] += 1
    elif b == N:
        road[a-1] += 1

if 2 in road:
    print("POSSIBLE")
else:
    print("IMPOSSIBLE")
# Original solution
n, m = list(map(int,input().split()))
    
aaa = 0
tbin_1 = []
tbin_n = []
for i in range(m):
    xxx = list(map(int,input().split()))
    if xxx[0] == 1:
        tbin_1.append(xxx[1])
        if xxx[1] in tbin_n:
            aaa = 1
            break
            
    elif xxx[1] == n :
        tbin_n.append(xxx[0])
        if xxx[0] in tbin_1:
            aaa = 1
            break
    else:
        None


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

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

boolins =[]
for i in range(n):
    boolins.append(0)
    
for i in range(m):
    xxx = list(map(int,input().split()))
    if xxx[0] == 1:
        boolins[xxx[1]] = boolins[xxx[1]] + 1
    elif xxx[1] == n :
        boolins[xxx[0]]=boolins[xxx[0]]+ 1
    else:
        None


if 2 in boolins:
    print('POSSIBLE')
else:
    print('IMPOSSIBLE')
# Original solution
from collections import defaultdict
d = defaultdict(list)
n, m = list(map(int, input().split()))
for _ in range(m):
    a, b = list(map(int, input().split()))
    d[a].append(b)

# アクセスを高速にするためにsetに変換
for a in list(d.keys()):
    d[a] = set(d[a])


def solve(n, d):
    for a in d[1]:
        if n in d[a]:
            return 'POSSIBLE'
    return 'IMPOSSIBLE'


print((solve(n, d)))


# Optimized solution
from collections import defaultdict
d = defaultdict(set)
n, m = list(map(int, input().split()))
for _ in range(m):
    a, b = list(map(int, input().split()))
    d[a].add(b)


def solve(n, d):
    for a in d[1]:
        if n in d[a]:
            return 'POSSIBLE'
    return 'IMPOSSIBLE'


print((solve(n, d)))
# Original solution
N, M = list(map(int, input().split()))
ab = [list(map(int, input().split())) for i in range(M)]
ans = 0
tyukan = []
saigo = []
 
for i in range(M):
    if ab[i][0] == 1:
        tyukan.append(ab[i][1])
 
for i in range(M):
    if ab[i][0] in tyukan:
        if ab[i][1] == N:
            ans =1
            break
 
print(('POSSIBLE' if ans == 1 else 'IMPOSSIBLE')) 

# Optimized 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()))
    matrix[a-1].append(b-1)
    matrix[b-1].append(a-1)

for i in matrix[0]:
    if N-1 in matrix[i]:
        print('POSSIBLE')
        break
else:
    print('IMPOSSIBLE')
# Original solution
N, M = list(map(int, input().split()))
matrix = [[] for i in range(N)]
check1 = [0] * N
check1[0] = 1

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

for i in matrix[0]:
    if (N-1) in matrix[i]:
        print('POSSIBLE')
        break
else:
    print('IMPOSSIBLE')

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

for a, b in ab:
    if check[a-1] == 1 and b == N:
        print('POSSIBLE')
        break
else:
    print('IMPOSSIBLE')
# Original solution
import itertools

n, m = [int(_) for _ in input().split()]
a = []
b = []
for i in range(0, m):
    ai, bi = [int(_) for _ in input().split()]
    a.append(ai)
    b.append(bi)

flag = False
for i, j in itertools.product(list(range(0, m)), list(range(0, m))):
    if a[i] == 1 and b[i] == a[j] and b[j] == n:
        flag = True

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

# Optimized solution
import itertools

n, m = [int(_) for _ in input().split()]
a = []
b = []
for i in range(0, m):
    ai, bi = [int(_) for _ in input().split()]
    a.append(ai)
    b.append(bi)

first = [b[i] for i in range(0, m) if a[i] == 1]
second = [a[i] for i in range(0, m) if b[i] == n]

if set(first) & set(second):
    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)]
flag = 0
for i in range(M):
    if ab[i][0] == 1:
        j = 0
        for j in range(M):
            if ab[j] == [ab[i][1],N]:
                print("POSSIBLE")
                flag = 1
                break
    if flag == 1:
        break
if flag == 0:
    print("IMPOSSIBLE")

# Optimized solution
N,M = list(map(int,input().split()))
voy = [[] for i in range(N)]
for i in range(M):
    a,b = list(map(int,input().split()))
    voy[a-1].append(b)
alen = len(voy[0])
flag = 0
for j in range(alen):
    qu = voy[0][j]-1
    if N in voy[qu]:
        print("POSSIBLE")
        flag = 1
        break
if flag == 0:
    print("IMPOSSIBLE")
# Original solution
import sys
N,M = list(map(int,sys.stdin.readline().split()))
ab = []
start = []
goal = []
for i in range(M):
    ab.append(list(map(int,sys.stdin.readline().split())))
for i in ab:
    if i[0] == 1:
        start.append(i[1])
    if i[1] == N:
        goal.append(i[0])
ans = 'IMPOSSIBLE'
for i in range(1,N+1):
    if i in start and i in goal:
        ans = 'POSSIBLE'
        break
print(ans)

# Optimized solution
import sys
N,M = list(map(int,sys.stdin.readline().split()))
start = []
goal = []
for i in range(M):
    a,b = list(map(int,sys.stdin.readline().split()))
    if a == 1:
        start.append(b)
    if b == N:
        goal.append(a)
ans = 'IMPOSSIBLE'
seta = set(start)
setg = set(goal)
for i in seta:
    if i in setg:
        ans = 'POSSIBLE'
        break
print(ans)
# Original solution
n, m = list(map(int, input().split()))
l = [tuple(map(int, input().split())) for i in range(m)]
c = [[] for _ in range(n+1)]
for x in l:
    c[x[0]].append(x[1])
    c[x[1]].append(x[0])
if set(c[1])&set(c[n]):
    print("POSSIBLE")
else:
    print("IMPOSSIBLE")

# Optimized solution
import sys

readline = sys.stdin.buffer.readline
ni = lambda: int(readline().rstrip())
nm = lambda: list(map(int, readline().split()))
nl = lambda: list(map(int, readline().split()))

def solve():
    n, m = nm()
    G = [list() for _ in range(n)]
    for _ in range(m):
        u, v = nm()
        u -= 1; v -= 1
        G[u].append(v)
        G[v].append(u)
    if (set(G[0]) & set(G[n-1])):
        print('POSSIBLE')
    else:
        print('IMPOSSIBLE')
    return

solve()

# T = ni()
# for _ in range(T):
#     solve()
# Original solution
n,m=list(map(int,input().split()))
one_to=set()
to_n=set()
for i in range(m):
    a,b=list(map(int,input().split()))
    if a==1:
        one_to.add(b)
    elif b==n:
        to_n.add(a)
one_to=list(one_to)
flag=False
for i in range(len(one_to)):
    if one_to[i] in to_n:
        flag=True
        break
print(("POSSIBLE" if flag else "IMPOSSIBLE"))

# Optimized solution
n,m=list(map(int,input().split()))
one_to=[0]*(n+1)
to_n=[0]*(n+1)
for i in range(m):
    a,b=list(map(int,input().split()))
    if a==1:
        one_to[b]=1
    elif b==n:
        to_n[a]=1
flag=False
for i in range(2,n):
    if one_to[i]==1 and to_n[i]==1:
        flag=True
        break
print(("POSSIBLE" if flag else "IMPOSSIBLE"))
# Original solution
n,m = list(map(int,input().split()))
graph = [[0 for i in range(n)] for j in range(n)]
for i in range(m):
    a,b = list(map(int,input().split()))
    graph[a-1][b-1] = 1
    graph[b-1][a-1] = 1

flag = False
for i in range(n):
    if graph[0][i] == 1:
        if graph[i][n-1] == 1:
            flag = True
            break
                
if flag:
    print("POSSIBLE")
    
else:
    print("IMPOSSIBLE")


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

flag = False
for i in iki:
    if i in iki2:
        flag = True
        break
if flag:
    print("POSSIBLE")
    
else:
    print("IMPOSSIBLE")
# Original solution
N,M = list(map(int,input().split()))
edge = []
p = 'POSSIBLE'
i = 'IMPOSSIBLE'
for _ in range(M):
    edge.append(tuple(map(int,input().split())))

from1 = []
is_reach = False
for go,to in sorted(edge,key=lambda x:x[0]):
    if go == 1:
        from1.append(to)
    else:
        if go in from1 and to == N:
            is_reach = True
            break
print((p if is_reach else i))

# Optimized solution
N,M = list(map(int,input().split()))
edge = []
p = 'POSSIBLE'
i = 'IMPOSSIBLE'
for _ in range(M):
    edge.append(list(map(int,input().split())))

from1 = set()
is_reach = False
for go,to in sorted(edge,key=lambda x:x[0]):
    if go == 1:
        from1.add(to)
    else:
        if go in from1 and to == N:
            is_reach = True
            break
print((p if is_reach else i))
# Original solution
N,M = list(map(int,input().split()))
ab= [list(map(int,input().split())) for i in range(M)]

n = len(ab)

for i in range(n):
    if ab[i][1] != N:
        continue
    for j in range(n):
       if ab[i][0] == ab[j][1] and ab[j][0] == 1:
           print('POSSIBLE')
           exit()
print('IMPOSSIBLE')

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

s = []
g = []
for i in range(M):
    a,b = list(map(int,input().split()))
    if a == 1:
        s.append(b)
    elif b == N:
        g.append(a)
    
ans = set(s) & set(g)

if len(ans) >= 1:
    print('POSSIBLE')
else:
    print('IMPOSSIBLE')