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

ship = {i:[] for i in range(1, n+1)}



for _ in range(m):

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

    ship[a].append(b)



for i in ship[1]:

    if n in ship[i]:

        print("POSSIBLE")

        exit()

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

ship = {i:False for i in range(1, n+1)}

bl = []

for _ in range(m):

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

    if a == 1:

        ship[b] = True

    elif b == n:

        bl.append(a)



for i in bl:

    if ship[i] == True:

        print("POSSIBLE")

        exit()

print("IMPOSSIBLE")
n, m = list(map(int, input().split()))
ship = {i: [] for i in range(1, n + 1)}
for _ in range(m):
    a, b = list(map(int, input().split()))
    ship[a].append(b)
for i in ship[1]:
    if n in ship[i]:
        print("POSSIBLE")
        exit()
print("IMPOSSIBLE")

n, m = list(map(int, input().split()))
ship = {i: False for i in range(1, n + 1)}
bl = []
for _ in range(m):
    a, b = list(map(int, input().split()))
    if a == 1:
        ship[b] = True
    elif b == n:
        bl.append(a)
for i in bl:
    if ship[i] == True:
        print("POSSIBLE")
        exit()
print("IMPOSSIBLE")

-ship = {i: [] for i in range(1, n + 1)} +ship = {i: False for i in range(1, n + 1)} +bl = [] -    ship[a].append(b) -for i in ship[1]: -    if n in ship[i]: +    if a == 1: +        ship[b] = True +    elif b == n: +        bl.append(a) +for i in bl: +    if ship[i] == True: