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

l = [list(map(int,input().split())) for i in range(m)]



a = []

b = []

for i in l:

    if i[0] == 1:

        a.append(i[1])

    if i[1] == n:

        b.append(i[0])



print(("POSSIBLE" if len(set(a)&set(b)) > 0 else "IMPOSSIBLE"))
n,m = list(map(int,input().split()))

a = set()

b = set()

for i in range(m):

    a_,b_ = list(map(int,input().split()))

    if a_ == 1:

        a.add(b_)

    if b_ == n:

        b.add(a_)

print(("POSSIBLE" if a&b else "IMPOSSIBLE"))
n, m = list(map(int, input().split()))
l = [list(map(int, input().split())) for i in range(m)]
a = []
b = []
for i in l:
    if i[0] == 1:
        a.append(i[1])
    if i[1] == n:
        b.append(i[0])
print(("POSSIBLE" if len(set(a) & set(b)) > 0 else "IMPOSSIBLE"))

n, m = list(map(int, input().split()))
a = set()
b = set()
for i in range(m):
    a_, b_ = list(map(int, input().split()))
    if a_ == 1:
        a.add(b_)
    if b_ == n:
        b.add(a_)
print(("POSSIBLE" if a & b else "IMPOSSIBLE"))

-l = [list(map(int, input().split())) for i in range(m)] -a = [] -b = [] -for i in l: -    if i[0] == 1: -        a.append(i[1]) -    if i[1] == n: -        b.append(i[0]) -print(("POSSIBLE" if len(set(a) & set(b)) > 0 else "IMPOSSIBLE")) +a = set() +b = set() +for i in range(m): +    a_, b_ = list(map(int, input().split())) +    if a_ == 1: +        a.add(b_) +    if b_ == n: +        b.add(a_) +print(("POSSIBLE" if a & b else "IMPOSSIBLE"))