Buggy python submission (verdict: Runtime Error):
def dfs(now,prev,count):
    global flag
    flag=False
    # 今いる頂点から行ける頂点を順に next に入れてループ
    count+=1
    for next in g[now]:
        if next != prev:
            if next== n-1:
                if count==2:
                    flag=True
                    break
                else:
                    break
            dfs(next, now,count)
 
n, m = map(int, input().split())
g = [[] * n for i in range(n)]
for i in range(m):
    u, v = map(int, input().split())
    u -= 1
    v -= 1
    g[u].append(v)
    g[v].append(u)
dfs(0,-1,0)
if flag:
    print('POSSIBLE')
else:
    print('IMPOSSIBLE')




    





Fixed submission:
import sys

sys.setrecursionlimit(10**9)

def dfs(now,prev,count):
    # 今いる頂点から行ける頂点を順に next に入れてループ
    count+=1
    for next in g[now]:
        if count<=2:
            if next != prev:
                if next== n-1:
                    if count==2:
                        print('POSSIBLE')
                        exit()
                    else:
                        break
                dfs(next,now,count)
 
n, m = map(int, input().split())
g = [[] * n for i in range(n)]
for i in range(m):
    u, v = map(int, input().split())
    u -= 1
    v -= 1
    g[u].append(v)
    g[v].append(u)
dfs(0,-1,0)
print('IMPOSSIBLE')

Buggy python submission (verdict: Runtime Error):
def dfs(now,prev,count):
    global flag
    flag=False
    # 今いる頂点から行ける頂点を順に next に入れてループ
    count+=1
    for next in g[now]:
        if next != prev:
            if next== n-1:
                if count==2:
                    flag=True
                    break
                else:
                    break
            dfs(next, now,count)
 
n, m = map(int, input().split())
g = [[] * n for i in range(n)]
for i in range(m):
    u, v = map(int, input().split())
    u -= 1
    v -= 1
    g[u].append(v)
    g[v].append(u)
dfs(0,-1,0)
if flag:
    print('POSSIBBLE')
else:
    print('IMPOSSIBLE')




    





Fixed submission:
import sys

sys.setrecursionlimit(10**9)

def dfs(now,prev,count):
    # 今いる頂点から行ける頂点を順に next に入れてループ
    count+=1
    for next in g[now]:
        if count<=2:
            if next != prev:
                if next== n-1:
                    if count==2:
                        print('POSSIBLE')
                        exit()
                    else:
                        break
                dfs(next,now,count)
 
n, m = map(int, input().split())
g = [[] * n for i in range(n)]
for i in range(m):
    u, v = map(int, input().split())
    u -= 1
    v -= 1
    g[u].append(v)
    g[v].append(u)
dfs(0,-1,0)
print('IMPOSSIBLE')

Buggy python submission (verdict: Runtime Error):
def dfs(now,prev,count):
    global flag
    flag=False
    # 今いる頂点から行ける頂点を順に next に入れてループ
    count+=1
    for next in g[now]:
        if next != prev:
            if next== n-1:
                if count==2:
                    flag=True
                    break
                else:
                    break
            dfs(next, now,count)
 
n, m = map(int, input().split())
g = [[] * n for i in range(n)]
for i in range(m):
    u, v = map(int, input().split())
    u -= 1
    v -= 1
    g[u].append(v)
    g[v].append(u)
dfs(0,0,0)
if flag:
    print('POSIBBLE')
else:
    print('IMPOSSIBLE')




    





Fixed submission:
import sys

sys.setrecursionlimit(10**9)

def dfs(now,prev,count):
    # 今いる頂点から行ける頂点を順に next に入れてループ
    count+=1
    for next in g[now]:
        if count<=2:
            if next != prev:
                if next== n-1:
                    if count==2:
                        print('POSSIBLE')
                        exit()
                    else:
                        break
                dfs(next,now,count)
 
n, m = map(int, input().split())
g = [[] * n for i in range(n)]
for i in range(m):
    u, v = map(int, input().split())
    u -= 1
    v -= 1
    g[u].append(v)
    g[v].append(u)
dfs(0,-1,0)
print('IMPOSSIBLE')