from collections import defaultdict, deque



INF = 10**12

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

E = defaultdict(list)

for _ in range(M):

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

    E[a-1].append(b-1)

    E[b-1].append(a-1)

dist = [INF]*N

q = deque([(0, 0)])

while q:

    v, d = q.popleft()

    dist[v] = d

    for u in E[v]:

        if dist[u] == INF:

            q.append((u, d+1))

print(('POSSIBLE' if dist[N-1] == 2 else 'IMPOSSIBLE'))
N, M = list(map(int, input().split()))

from_1 = [False]*N

to_N = [False]*N

for _ in range(M):

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

    if a == 1:

        from_1[b-1] = True

    elif b == N:

        to_N[a-1] = True

for i in range(1, N):

    if from_1[i] and to_N[i]:

        print('POSSIBLE')

        break

else:

    print('IMPOSSIBLE')
from collections import defaultdict, deque

INF = 10**12
N, M = list(map(int, input().split()))
E = defaultdict(list)
for _ in range(M):
    a, b = list(map(int, input().split()))
    E[a - 1].append(b - 1)
    E[b - 1].append(a - 1)
dist = [INF] * N
q = deque([(0, 0)])
while q:
    v, d = q.popleft()
    dist[v] = d
    for u in E[v]:
        if dist[u] == INF:
            q.append((u, d + 1))
print(("POSSIBLE" if dist[N - 1] == 2 else "IMPOSSIBLE"))

N, M = list(map(int, input().split()))
from_1 = [False] * N
to_N = [False] * N
for _ in range(M):
    a, b = list(map(int, input().split()))
    if a == 1:
        from_1[b - 1] = True
    elif b == N:
        to_N[a - 1] = True
for i in range(1, N):
    if from_1[i] and to_N[i]:
        print("POSSIBLE")
        break
else:
    print("IMPOSSIBLE")

-from collections import defaultdict, deque - -INF = 10**12 -E = defaultdict(list) +from_1 = [False] * N +to_N = [False] * N -    E[a - 1].append(b - 1) -    E[b - 1].append(a - 1) -dist = [INF] * N -q = deque([(0, 0)]) -while q: -    v, d = q.popleft() -    dist[v] = d -    for u in E[v]: -        if dist[u] == INF: -            q.append((u, d + 1)) -print(("POSSIBLE" if dist[N - 1] == 2 else "IMPOSSIBLE")) +    if a == 1: +        from_1[b - 1] = True +    elif b == N: +        to_N[a - 1] = True +for i in range(1, N): +    if from_1[i] and to_N[i]: +        print("POSSIBLE") +        break +else: +    print("IMPOSSIBLE")