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 node0 in graph[0]:

    for node1 in graph[node0]:

        if node1 == N - 1:

            print("POSSIBLE")

            exit()

print("IMPOSSIBLE")
import bisect

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

start_to_middle = []

middle_to_end = []

for i in range(M):

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

    if a == 1:

        start_to_middle.append(b)

    elif b == N:

        middle_to_end.append(a)

if not len(start_to_middle) or not len(middle_to_end):

    print('IMPOSSIBLE')

    exit()

middle_to_end.sort()

for middle in start_to_middle:

    idx = bisect.bisect_left(middle_to_end, middle)

    if idx < len(middle_to_end) and middle_to_end[idx] == middle:

        print('POSSIBLE')

        exit()



print('IMPOSSIBLE')

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 node0 in graph[0]:
    for node1 in graph[node0]:
        if node1 == N - 1:
            print("POSSIBLE")
            exit()
print("IMPOSSIBLE")

import bisect

N, M = list(map(int, input().split()))
start_to_middle = []
middle_to_end = []
for i in range(M):
    a, b = list(map(int, input().split()))
    if a == 1:
        start_to_middle.append(b)
    elif b == N:
        middle_to_end.append(a)
if not len(start_to_middle) or not len(middle_to_end):
    print("IMPOSSIBLE")
    exit()
middle_to_end.sort()
for middle in start_to_middle:
    idx = bisect.bisect_left(middle_to_end, middle)
    if idx < len(middle_to_end) and middle_to_end[idx] == middle:
        print("POSSIBLE")
        exit()
print("IMPOSSIBLE")

+import bisect + -graph = [[] for _ in range(N)] -for _ in range(M): +start_to_middle = [] +middle_to_end = [] +for i in range(M): -    graph[a - 1].append(b - 1) -    graph[b - 1].append(a - 1) -for node0 in graph[0]: -    for node1 in graph[node0]: -        if node1 == N - 1: -            print("POSSIBLE") -            exit() +    if a == 1: +        start_to_middle.append(b) +    elif b == N: +        middle_to_end.append(a) +if not len(start_to_middle) or not len(middle_to_end): +    print("IMPOSSIBLE") +    exit() +middle_to_end.sort() +for middle in start_to_middle: +    idx = bisect.bisect_left(middle_to_end, middle) +    if idx < len(middle_to_end) and middle_to_end[idx] == middle: +        print("POSSIBLE") +        exit()