Buggy python submission (verdict: Runtime Error):
N,M=map(int,input().split())
x=[0]*(n+1)
y=[0]*(n+1)
for i in range(M):
    a,b=map(int,input().split())
    if a==1:
        x[b]=1
    if b==N:
        y[a]=1
for i in range(N+1):
    if x[i]==1 and y[i]==1:
        print("POSSIBLE")
        break
else:
    print("IMPOSSIBLE")

Fixed submission:
N,M=map(int,input().split())
x=[0]*(N+1)
y=[0]*(N+1)
for i in range(M):
    a,b=map(int,input().split())
    if a==1:
        x[b]=1
    if b==N:
        y[a]=1
for i in range(N+1):
    if x[i]==1 and y[i]==1:
        print("POSSIBLE")
        break
else:
    print("IMPOSSIBLE")

Buggy python submission (verdict: Time Limit Exceeded):
N,M=map(int,input().split())
x=[]
y=[]
for i in range(M):
    a,b=map(int,input().split())
    if a==1:
        x.append(b)
    if b==N:
        y.append(a)
x.sort()
y.sort()
for i in x:
    if i in y:
        print("POSSIBLE")
        break
else:
    print("IMPOSSIBLE")

Fixed submission:
N,M=map(int,input().split())
x=[0]*(N+1)
y=[0]*(N+1)
for i in range(M):
    a,b=map(int,input().split())
    if a==1:
        x[b]=1
    if b==N:
        y[a]=1
for i in range(N+1):
    if x[i]==1 and y[i]==1:
        print("POSSIBLE")
        break
else:
    print("IMPOSSIBLE")

Buggy python submission (verdict: Time Limit Exceeded):
N,M=map(int,input().split())
x=[]
y=[]
for i in range(M):
    a,b=map(int,input().split())
    if a==1:
        x.append(b)
    if b==N:
        y.append(a)
x.sort()
y.sort()
for i in x:
    if i in y:
        print("POSSIBLE")
        break
else:
    print("IMPOSSIBLE")

Fixed submission:
N,M=map(int,input().split())
x=[0]*(N+1)
y=[0]*(N+1)
for i in range(M):
    a,b=map(int,input().split())
    if a==1:
        x[b]=1
    if b==N:
        y[a]=1
for i in range(N+1):
    if x[i]==1 and y[i]==1:
        print("POSSIBLE")
        break
else:
    print("IMPOSSIBLE")

Buggy python submission (verdict: Time Limit Exceeded):
N,M=map(int,input().split())
v=[]
x=[]
y=[]
for i in range(M):
    a,b=map(int,input().split())
    if a==1:
        x.append(b)
    if b==N:
        y.append(a)
for i in x:
    if i in y:
        print("POSSIBLE")
        break
else:
    print("IMPOSSIBLE")

Fixed submission:
N,M=map(int,input().split())
x=[0]*(N+1)
y=[0]*(N+1)
for i in range(M):
    a,b=map(int,input().split())
    if a==1:
        x[b]=1
    if b==N:
        y[a]=1
for i in range(N+1):
    if x[i]==1 and y[i]==1:
        print("POSSIBLE")
        break
else:
    print("IMPOSSIBLE")

Buggy python submission (verdict: Time Limit Exceeded):
N,M=map(int,input().split())
v=[]
x=[]
y=[]
for i in range(M):
    a,b=map(int,input().split())
    if a==1:
        x.append(b)
    if b==N:
        y.append(a)
for i in x:
    if i in y:
        print("POSSIBLE")
        break
else:
    print("IMPOSSIBLE")

Fixed submission:
N,M=map(int,input().split())
x=[0]*(N+1)
y=[0]*(N+1)
for i in range(M):
    a,b=map(int,input().split())
    if a==1:
        x[b]=1
    if b==N:
        y[a]=1
for i in range(N+1):
    if x[i]==1 and y[i]==1:
        print("POSSIBLE")
        break
else:
    print("IMPOSSIBLE")

Buggy python submission (verdict: Time Limit Exceeded):
N,M=map(int,input().split())
flag = False
v=[]
x=[]
y=[]
for i in range(M):
    a,b=map(int,input().split())
    if a==1:
        x.append(b)
    if b==N:
        y.append(a)
for i in x:
    for j in y:
        if i==j:
            flag=True
            break
    if flag:
        print("POSSIBLE")
        break
else:
    print("IMPOSSIBLE")

Fixed submission:
N,M=map(int,input().split())
x=[0]*(N+1)
y=[0]*(N+1)
for i in range(M):
    a,b=map(int,input().split())
    if a==1:
        x[b]=1
    if b==N:
        y[a]=1
for i in range(N+1):
    if x[i]==1 and y[i]==1:
        print("POSSIBLE")
        break
else:
    print("IMPOSSIBLE")

Buggy python submission (verdict: Time Limit Exceeded):
N,M=map(int,input().split())
flag = False
v=[]
x=[]
y=[]
for i in range(M):
    a,b=map(int,input().split())
    if a==1:
        x.append(b)
    if b==N:
        y.append(a)
for i in x:
    for j in y:
        if i==j:
            flag=True
            break
    if flag:
        print("POSSIBLE")
        break
else:
    print("IMPOSSIBLE")

Fixed submission:
N,M=map(int,input().split())
x=[0]*(N+1)
y=[0]*(N+1)
for i in range(M):
    a,b=map(int,input().split())
    if a==1:
        x[b]=1
    if b==N:
        y[a]=1
for i in range(N+1):
    if x[i]==1 and y[i]==1:
        print("POSSIBLE")
        break
else:
    print("IMPOSSIBLE")

Buggy python submission (verdict: Time Limit Exceeded):
N,M=map(int,input().split())
flag = False
v=[]
x=[]
y=[]
for i in range(M):
    a,b=map(int,input().split())
    v.append((a,b))
    if a==1:
        x.append(b)
    if b==N:
        y.append(a)
for i in x:
    for j in y:
        if i==j:
            flag=True
            break
    if flag:
        print("POSSIBLE")
        break
else:
    print("IMPOSSIBLE")

Fixed submission:
N,M=map(int,input().split())
x=[0]*(N+1)
y=[0]*(N+1)
for i in range(M):
    a,b=map(int,input().split())
    if a==1:
        x[b]=1
    if b==N:
        y[a]=1
for i in range(N+1):
    if x[i]==1 and y[i]==1:
        print("POSSIBLE")
        break
else:
    print("IMPOSSIBLE")

Buggy python submission (verdict: Time Limit Exceeded):
N,M=map(int,input().split())
flag = False
v=[]
for i in range(M):
    a,b=map(int,input().split())
    v.append([a,b])
for i in range(M):
    for j in range(M):
        if v[i][1]==N:
            if v[j][1]==v[i][0] and v[j][0]==1:
                flag=True
                break
    if flag:
        print("POSSIBLE")
        break
else:
    print("IMPOSSIBLE")

Fixed submission:
N,M=map(int,input().split())
x=[0]*(N+1)
y=[0]*(N+1)
for i in range(M):
    a,b=map(int,input().split())
    if a==1:
        x[b]=1
    if b==N:
        y[a]=1
for i in range(N+1):
    if x[i]==1 and y[i]==1:
        print("POSSIBLE")
        break
else:
    print("IMPOSSIBLE")