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

x = 1

y = 1



for m in range(M):

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

    if a==1:

      x|=1<<b

    if b==N:

      y|=1<<a



print(("IM"*(x&y==1)+"POSSIBLE"))
N,M = list(map(int,input().split()))

x = set()

y = set()



for m in range(M):

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

    if a==1:

      x.add(b)

    if b==N:

      y.add(a)



if x&y:

  print("POSSIBLE")

else:

  print("IMPOSSIBLE")
N, M = list(map(int, input().split()))
x = 1
y = 1
for m in range(M):
    a, b = list(map(int, input().split()))
    if a == 1:
        x |= 1 << b
    if b == N:
        y |= 1 << a
print(("IM" * (x & y == 1) + "POSSIBLE"))

N, M = list(map(int, input().split()))
x = set()
y = set()
for m in range(M):
    a, b = list(map(int, input().split()))
    if a == 1:
        x.add(b)
    if b == N:
        y.add(a)
if x & y:
    print("POSSIBLE")
else:
    print("IMPOSSIBLE")

-x = 1 -y = 1 +x = set() +y = set() -        x |= 1 << b +        x.add(b) -        y |= 1 << a -print(("IM" * (x & y == 1) + "POSSIBLE")) +        y.add(a) +if x & y: +    print("POSSIBLE") +else: +    print("IMPOSSIBLE")