import sys

import collections





def solve():

    sys.setrecursionlimit(2000)

    input = sys.stdin.readline

    mod = 10 ** 9 + 7

    n, m = list(map(int, input().rstrip('\n').split()))

    d = collections.defaultdict(list)

    for i in range(m):

        a, b = list(map(int, input().rstrip('\n').split()))

        if a == 1:

            d[b] += [1]

        if b == 1:

            d[a] += [1]

        if a == n:

            d[b] += [n]

        if b == n:

            d[a] += [n]

    for k, v in list(d.items()):

        if len(v) == 2:

            print("POSSIBLE")

            exit()

    print("IMPOSSIBLE")





if __name__ == '__main__':

    solve()

import sys

import collections





def solve():

    readline = sys.stdin.buffer.readline

    mod = 10 ** 9 + 7

    n, m = list(map(int, readline().split()))

    d = collections.defaultdict(list)

    for _ in range(m):

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

        if a == 1 or a == n:

            if a not in d[b]:

                d[b] += [a]

        elif b == 1 or b == n:

            if b not in d[a]:

                d[a] += [b]

    for k, v in list(d.items()):

        if k != 1 and k != n:

            if len(v) == 2:

                print("POSSIBLE")

                exit()

    print("IMPOSSIBLE")





if __name__ == '__main__':

    solve()

import sys
import collections


def solve():
    sys.setrecursionlimit(2000)
    input = sys.stdin.readline
    mod = 10**9 + 7
    n, m = list(map(int, input().rstrip("\n").split()))
    d = collections.defaultdict(list)
    for i in range(m):
        a, b = list(map(int, input().rstrip("\n").split()))
        if a == 1:
            d[b] += [1]
        if b == 1:
            d[a] += [1]
        if a == n:
            d[b] += [n]
        if b == n:
            d[a] += [n]
    for k, v in list(d.items()):
        if len(v) == 2:
            print("POSSIBLE")
            exit()
    print("IMPOSSIBLE")


if __name__ == "__main__":
    solve()

import sys
import collections


def solve():
    readline = sys.stdin.buffer.readline
    mod = 10**9 + 7
    n, m = list(map(int, readline().split()))
    d = collections.defaultdict(list)
    for _ in range(m):
        a, b = list(map(int, readline().split()))
        if a == 1 or a == n:
            if a not in d[b]:
                d[b] += [a]
        elif b == 1 or b == n:
            if b not in d[a]:
                d[a] += [b]
    for k, v in list(d.items()):
        if k != 1 and k != n:
            if len(v) == 2:
                print("POSSIBLE")
                exit()
    print("IMPOSSIBLE")


if __name__ == "__main__":
    solve()

-    sys.setrecursionlimit(2000) -    input = sys.stdin.readline +    readline = sys.stdin.buffer.readline -    n, m = list(map(int, input().rstrip("\n").split())) +    n, m = list(map(int, readline().split())) -    for i in range(m): -        a, b = list(map(int, input().rstrip("\n").split())) -        if a == 1: -            d[b] += [1] -        if b == 1: -            d[a] += [1] -        if a == n: -            d[b] += [n] -        if b == n: -            d[a] += [n] +    for _ in range(m): +        a, b = list(map(int, readline().split())) +        if a == 1 or a == n: +            if a not in d[b]: +                d[b] += [a] +        elif b == 1 or b == n: +            if b not in d[a]: +                d[a] += [b] -        if len(v) == 2: -            print("POSSIBLE") -            exit() +        if k != 1 and k != n: +            if len(v) == 2: +                print("POSSIBLE") +                exit()