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

AB = [tuple(map(int,input().split())) for i in range(M)]

sa = set()

sb = set()

for a,b in AB:

    if a==1:

        sa.add(b)

    if b==N:

        sb.add(a)

s = sa & sb

print(('POSSIBLE' if len(s) else 'IMPOSSIBLE'))
N,M = list(map(int,input().split()))

AB = [tuple(map(int,input().split())) for i in range(M)]



s1 = set()

sn = set()

for a,b in AB:

    if a==1:

        s1.add(b)

    if b==N:

        sn.add(a)



print(('POSSIBLE' if s1&sn else 'IMPOSSIBLE'))
N, M = list(map(int, input().split()))
AB = [tuple(map(int, input().split())) for i in range(M)]
sa = set()
sb = set()
for a, b in AB:
    if a == 1:
        sa.add(b)
    if b == N:
        sb.add(a)
s = sa & sb
print(("POSSIBLE" if len(s) else "IMPOSSIBLE"))

N, M = list(map(int, input().split()))
AB = [tuple(map(int, input().split())) for i in range(M)]
s1 = set()
sn = set()
for a, b in AB:
    if a == 1:
        s1.add(b)
    if b == N:
        sn.add(a)
print(("POSSIBLE" if s1 & sn else "IMPOSSIBLE"))

-sa = set() -sb = set() +s1 = set() +sn = set() -        sa.add(b) +        s1.add(b) -        sb.add(a) -s = sa & sb -print(("POSSIBLE" if len(s) else "IMPOSSIBLE")) +        sn.add(a) +print(("POSSIBLE" if s1 & sn else "IMPOSSIBLE"))