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

n -= 1



ab = [[] for i in range(n)]



for _ in range(m):

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

    ab[a-1].append(b-1)



for i in ab[0]:

    for j in ab[i]:

        if j == n:

            print("POSSIBLE")

            exit()



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



x = [[] for _ in range(n)]

for _ in range(m):

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

    x[a-1].append(b-1)



if x[0] == []:

    print("IMPOSSIBLE")

    exit()



for i in x[0]:

    for j in x[i]:

        if j == n-1:

            print("POSSIBLE")

            exit()



print("IMPOSSIBLE")
n, m = list(map(int, input().split()))
n -= 1
ab = [[] for i in range(n)]
for _ in range(m):
    a, b = list(map(int, input().split()))
    ab[a - 1].append(b - 1)
for i in ab[0]:
    for j in ab[i]:
        if j == n:
            print("POSSIBLE")
            exit()
print("IMPOSSIBLE")

n, m = list(map(int, input().split()))
x = [[] for _ in range(n)]
for _ in range(m):
    a, b = list(map(int, input().split()))
    x[a - 1].append(b - 1)
if x[0] == []:
    print("IMPOSSIBLE")
    exit()
for i in x[0]:
    for j in x[i]:
        if j == n - 1:
            print("POSSIBLE")
            exit()
print("IMPOSSIBLE")

-n -= 1 -ab = [[] for i in range(n)] +x = [[] for _ in range(n)] -    ab[a - 1].append(b - 1) -for i in ab[0]: -    for j in ab[i]: -        if j == n: +    x[a - 1].append(b - 1) +if x[0] == []: +    print("IMPOSSIBLE") +    exit() +for i in x[0]: +    for j in x[i]: +        if j == n - 1: