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

l = [0] * (n+1)

for _ in range(m):

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

  if a == 1: l[b] += 1

  if b == n: l[a] += 1



print(("POSSIBLE" if 2 in l else "IMPOSSIBLE"))
n,m = list(map(int, input().split()))

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

start = []

goal = []

for a,b in ab:

    if a == 1: start.append(b)

    elif b == n: goal.append(a)

print(("POSSIBLE" if list(set(start) & set(goal)) else "IMPOSSIBLE"))
n, m = list(map(int, input().split()))
l = [0] * (n + 1)
for _ in range(m):
    a, b = list(map(int, input().split()))
    if a == 1:
        l[b] += 1
    if b == n:
        l[a] += 1
print(("POSSIBLE" if 2 in l else "IMPOSSIBLE"))

n, m = list(map(int, input().split()))
ab = [list(map(int, input().split())) for _ in range(m)]
start = []
goal = []
for a, b in ab:
    if a == 1:
        start.append(b)
    elif b == n:
        goal.append(a)
print(("POSSIBLE" if list(set(start) & set(goal)) else "IMPOSSIBLE"))

-l = [0] * (n + 1) -for _ in range(m): -    a, b = list(map(int, input().split())) +ab = [list(map(int, input().split())) for _ in range(m)] +start = [] +goal = [] +for a, b in ab: -        l[b] += 1 -    if b == n: -        l[a] += 1 -print(("POSSIBLE" if 2 in l else "IMPOSSIBLE")) +        start.append(b) +    elif b == n: +        goal.append(a) +print(("POSSIBLE" if list(set(start) & set(goal)) else "IMPOSSIBLE"))