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

transit_a = set()

transit_b = set()

for _ in range(m):

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

    if a == 1:

        transit_b |= {b}

    elif b == n:

        transit_a |= {a}



print(('POSSIBLE' if len(transit_a & transit_b) else 'IMPOSSIBLE'))
n, m = list(map(int, input().split()))

transit_a = set()

transit_b = set()

for _ in range(m):

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

    if a == 1:

        transit_b.add(b)

    elif b == n:

        transit_a.add(a)



print(('POSSIBLE' if len(transit_a & transit_b) else 'IMPOSSIBLE'))

n, m = list(map(int, input().split()))
transit_a = set()
transit_b = set()
for _ in range(m):
    a, b = list(map(int, input().split()))
    if a == 1:
        transit_b |= {b}
    elif b == n:
        transit_a |= {a}
print(("POSSIBLE" if len(transit_a & transit_b) else "IMPOSSIBLE"))

n, m = list(map(int, input().split()))
transit_a = set()
transit_b = set()
for _ in range(m):
    a, b = list(map(int, input().split()))
    if a == 1:
        transit_b.add(b)
    elif b == n:
        transit_a.add(a)
print(("POSSIBLE" if len(transit_a & transit_b) else "IMPOSSIBLE"))

-        transit_b |= {b} +        transit_b.add(b) -        transit_a |= {a} +        transit_a.add(a)