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

E=[[] for i in range(N)]

for i in range(M):

  a,b=list(map(int,input().split()))

  a,b=a-1,b-1

  E[a].append(b)

  E[b].append(a)

  

if N==1:

  print("POSSIBLE")

  exit(0)



stack=[]

stack.append([0,2,-1])

while stack:

  node=stack.pop()

  v=node[0]

  ship=node[1]

  parent=node[2]

  if v==N-1 and ship==0:

    print("POSSIBLE")

    break

  if ship<=0:

    continue

  childs=E[v]

  for child in childs:

    if child==parent:

      continue

    stack.append([child,ship-1,v])

else:

  print("IMPOSSIBLE")

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

from1=set()

toN=set()

for i in range(M):

  a,b=list(map(int,input().split()))

  if a==1:

    from1.add(b)

  elif b==N:

    toN.add(a)

print((("","IM")[len(from1&toN)==0]+"POSSIBLE"))

  
N, M = list(map(int, input().split()))
E = [[] for i in range(N)]
for i in range(M):
    a, b = list(map(int, input().split()))
    a, b = a - 1, b - 1
    E[a].append(b)
    E[b].append(a)
if N == 1:
    print("POSSIBLE")
    exit(0)
stack = []
stack.append([0, 2, -1])
while stack:
    node = stack.pop()
    v = node[0]
    ship = node[1]
    parent = node[2]
    if v == N - 1 and ship == 0:
        print("POSSIBLE")
        break
    if ship <= 0:
        continue
    childs = E[v]
    for child in childs:
        if child == parent:
            continue
        stack.append([child, ship - 1, v])
else:
    print("IMPOSSIBLE")

N, M = list(map(int, input().split()))
from1 = set()
toN = set()
for i in range(M):
    a, b = list(map(int, input().split()))
    if a == 1:
        from1.add(b)
    elif b == N:
        toN.add(a)
print((("", "IM")[len(from1 & toN) == 0] + "POSSIBLE"))

-E = [[] for i in range(N)] +from1 = set() +toN = set() -    a, b = a - 1, b - 1 -    E[a].append(b) -    E[b].append(a) -if N == 1: -    print("POSSIBLE") -    exit(0) -stack = [] -stack.append([0, 2, -1]) -while stack: -    node = stack.pop() -    v = node[0] -    ship = node[1] -    parent = node[2] -    if v == N - 1 and ship == 0: -        print("POSSIBLE") -        break -    if ship <= 0: -        continue -    childs = E[v] -    for child in childs: -        if child == parent: -            continue -        stack.append([child, ship - 1, v]) -else: -    print("IMPOSSIBLE") +    if a == 1: +        from1.add(b) +    elif b == N: +        toN.add(a) +print((("", "IM")[len(from1 & toN) == 0] + "POSSIBLE"))