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



islands = {}

for i in range(M):

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

    if a not in islands:

        islands[a] = {}

    if b not in islands:

        islands[b] = {}

    islands[a][b] = islands[b][a] = 1



if N not in islands:

    print('IMPOSSIBLE')

    exit()

for i in list(islands[1].keys()):

    if i in islands[N]:

        print('POSSIBLE')

        exit()

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

d = {}

for _ in range(m):

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

    if a not in d:

        d[a] = {}

    if b not in d:

        d[b] = {}

    d[a][b] = d[b][a] = 1



for v in list(d.values()):

    if 1 in v and n in v:

        print('POSSIBLE')

        break

else:

    print('IMPOSSIBLE')

N, M = list(map(int, input().split()))
islands = {}
for i in range(M):
    a, b = list(map(int, input().split()))
    if a not in islands:
        islands[a] = {}
    if b not in islands:
        islands[b] = {}
    islands[a][b] = islands[b][a] = 1
if N not in islands:
    print("IMPOSSIBLE")
    exit()
for i in list(islands[1].keys()):
    if i in islands[N]:
        print("POSSIBLE")
        exit()
print("IMPOSSIBLE")

n, m = list(map(int, input().split()))
d = {}
for _ in range(m):
    a, b = list(map(int, input().split()))
    if a not in d:
        d[a] = {}
    if b not in d:
        d[b] = {}
    d[a][b] = d[b][a] = 1
for v in list(d.values()):
    if 1 in v and n in v:
        print("POSSIBLE")
        break
else:
    print("IMPOSSIBLE")

-N, M = list(map(int, input().split())) -islands = {} -for i in range(M): +n, m = list(map(int, input().split())) +d = {} +for _ in range(m): -    if a not in islands: -        islands[a] = {} -    if b not in islands: -        islands[b] = {} -    islands[a][b] = islands[b][a] = 1 -if N not in islands: +    if a not in d: +        d[a] = {} +    if b not in d: +        d[b] = {} +    d[a][b] = d[b][a] = 1 +for v in list(d.values()): +    if 1 in v and n in v: +        print("POSSIBLE") +        break +else: -    exit() -for i in list(islands[1].keys()): -    if i in islands[N]: -        print("POSSIBLE") -        exit() -print("IMPOSSIBLE")