from collections import deque



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

l=[list(map(int,input().split())) for i in range(m)]



sx=0

gx=n-1



tree=[[] for i in range(n)]

for i in l:

    tree[i[0]-1].append(i[1]-1)

    tree[i[1]-1].append(i[0]-1)



dist=[-1 for i in range(n)]

dist[sx]=0



que=deque()

que.append(sx)



while que:

    x=que.popleft()



    if x==gx and dist[gx]==2:

        print('POSSIBLE')

        exit()

    elif x==gx and dist[gx]!=2:

        print('IMPOSSIBLE')

        exit()



    for j in tree[x]:

        if dist[j]==-1:

            que.append(j)

            dist[j]=dist[x]+1



print('IMPOSSIBLE')
n,m=list(map(int,input().split()))

l=[list(map(int,input().split())) for i in range(m)]



tree=[[] for i in range(n)]

for i in l:

    tree[i[0]-1].append(i[1]-1)

    tree[i[1]-1].append(i[0]-1)



for i in tree:

    if 0 in i and n-1 in i:

        print('POSSIBLE')

        exit()

print('IMPOSSIBLE')
from collections import deque

n, m = list(map(int, input().split()))
l = [list(map(int, input().split())) for i in range(m)]
sx = 0
gx = n - 1
tree = [[] for i in range(n)]
for i in l:
    tree[i[0] - 1].append(i[1] - 1)
    tree[i[1] - 1].append(i[0] - 1)
dist = [-1 for i in range(n)]
dist[sx] = 0
que = deque()
que.append(sx)
while que:
    x = que.popleft()
    if x == gx and dist[gx] == 2:
        print("POSSIBLE")
        exit()
    elif x == gx and dist[gx] != 2:
        print("IMPOSSIBLE")
        exit()
    for j in tree[x]:
        if dist[j] == -1:
            que.append(j)
            dist[j] = dist[x] + 1
print("IMPOSSIBLE")

n, m = list(map(int, input().split()))
l = [list(map(int, input().split())) for i in range(m)]
tree = [[] for i in range(n)]
for i in l:
    tree[i[0] - 1].append(i[1] - 1)
    tree[i[1] - 1].append(i[0] - 1)
for i in tree:
    if 0 in i and n - 1 in i:
        print("POSSIBLE")
        exit()
print("IMPOSSIBLE")

-from collections import deque - -sx = 0 -gx = n - 1 -dist = [-1 for i in range(n)] -dist[sx] = 0 -que = deque() -que.append(sx) -while que: -    x = que.popleft() -    if x == gx and dist[gx] == 2: +for i in tree: +    if 0 in i and n - 1 in i: -    elif x == gx and dist[gx] != 2: -        print("IMPOSSIBLE") -        exit() -    for j in tree[x]: -        if dist[j] == -1: -            que.append(j) -            dist[j] = dist[x] + 1