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)))

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')

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)))

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")

-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))) +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")