Buggy python submission (verdict: Runtime Error):
N = int(input())
edges = [[] for _ in range(N)]
for _ in range(N-1):
    a,b = map(int,input().split())
    edges[a-1].append(b-1)
    edges[b-1].append(a-1)
# visited = [False for _ in range(N)]
def dfs(start,stop,visitedArray):
    visitedArray[start] = True
    if start == stop:
        return
    else:
        for term in edges[start]:
            if visitedArray[term]:
                continue
            dfs(term,stop,visitedArray)
fennec = [False for _ in range(N)]
snuke = [False for _ in range(N)]
dfs(0,N-1,fennec)
dfs(N-1,0,snuke)
# print(fennec)
# print(snuke)
F = S = C = 0
for i in range(1,N-1):
    if fennec[i] and snuke[i]:
        C += 1
    else:
        if fennec[i]:
            F += 1
        else:
            S += 1
# F = fennec + common//2 + common%2
# S = snuke + common//2
# print(F,S,C)
F += C//2 + C%2
S += C//2
if F > S:
    print("Fennec")
else:
    print("Snuke")

Fixed submission:
import sys
sys.setrecursionlimit(2*10**5)
N = int(input())
edges = [[] for _ in range(N)]
for _ in range(N-1):
    a,b = map(int,input().split())
    edges[a-1].append(b-1)
    edges[b-1].append(a-1)
visited = [False for _ in range(N)]
fennec = [-1 for _ in range(N)]
snuke = [-1 for _ in range(N)]
def dfs(start,visited,distance,d):
    visited[start] = True
    d[start] = distance
    for term in edges[start]:
        if visited[term]:
            continue
        dfs(term,visited,distance + 1,d)
dfs(0,visited,0,fennec)

visited = [False for _ in range(N)]
    
dfs(N-1,visited,0,snuke)
F = S = 0
for i in range(N):
    if fennec[i] <= snuke[i]:
        F+=1
    else:
        S+=1
if F>S:
    print("Fennec")
else:
    print("Snuke")

Buggy python submission (verdict: Runtime Error):
N = int(input())
edges = [[] for _ in range(N)]
for _ in range(N-1):
    a,b = map(int,input().split())
    edges[a-1].append(b-1)
    edges[b-1].append(a-1)
visited = [False for _ in range(N)]
def dfs(start,stop):
    visited[start] = True
    if start == stop:
        return
    else:
        for term in edges[start]:
            if visited[term]: continue
            dfs(term,stop)
dfs(0,N-1)
import copy 
fromFennec = copy.deepcopy(visited)
visited = [False for _ in range(N)]
dfs(N-1,0)
fennec = common = snuke = 0
# print(fromFennec)
# print(visited)
for i in range(1,N-1):
    if fromFennec[i] and visited[i]:
        common += 1
    else:
        if fromFennec[i]:
            fennec += 1
        else:
            snuke += 1
F = fennec + common//2 + common%2
S = snuke + common//2
if F > S:
    print("Fennec")
else:
    print("Snuke")

            


Fixed submission:
import sys
sys.setrecursionlimit(2*10**5)
N = int(input())
edges = [[] for _ in range(N)]
for _ in range(N-1):
    a,b = map(int,input().split())
    edges[a-1].append(b-1)
    edges[b-1].append(a-1)
visited = [False for _ in range(N)]
fennec = [-1 for _ in range(N)]
snuke = [-1 for _ in range(N)]
def dfs(start,visited,distance,d):
    visited[start] = True
    d[start] = distance
    for term in edges[start]:
        if visited[term]:
            continue
        dfs(term,visited,distance + 1,d)
dfs(0,visited,0,fennec)

visited = [False for _ in range(N)]
    
dfs(N-1,visited,0,snuke)
F = S = 0
for i in range(N):
    if fennec[i] <= snuke[i]:
        F+=1
    else:
        S+=1
if F>S:
    print("Fennec")
else:
    print("Snuke")

Buggy python submission (verdict: Runtime Error):
N = int(input())
edges = [[] for _ in range(N)]
for _ in range(N-1):
    a,b = map(int,input().split())
    edges[a-1].append(b-1)
    edges[b-1].append(a-1)
visited = [False for _ in range(N)]
def dfs(start,stop):
    visited[start] = True
    if start == stop:
        return
    else:
        for term in edges[start]:
            if visited[term]: continue
            dfs(term,stop)
dfs(0,N-1)
import copy 
fromFennec = copy.deepcopy(visited)
visited = [False for _ in range(N)]
fennec = common = snuke = 0
for i in range(1,N-1):
    if fromFennec[i] and visited[i]:
        common += 1
    else:
        if fromFennec[i]:
            fennec += 1
        else:
            snuke += 1
F = fennec + common//2 + common%2
S = snuke + common//2
if F > S:
    print("Fennec")
else:
    print("Snuke")

            


Fixed submission:
import sys
sys.setrecursionlimit(2*10**5)
N = int(input())
edges = [[] for _ in range(N)]
for _ in range(N-1):
    a,b = map(int,input().split())
    edges[a-1].append(b-1)
    edges[b-1].append(a-1)
visited = [False for _ in range(N)]
fennec = [-1 for _ in range(N)]
snuke = [-1 for _ in range(N)]
def dfs(start,visited,distance,d):
    visited[start] = True
    d[start] = distance
    for term in edges[start]:
        if visited[term]:
            continue
        dfs(term,visited,distance + 1,d)
dfs(0,visited,0,fennec)

visited = [False for _ in range(N)]
    
dfs(N-1,visited,0,snuke)
F = S = 0
for i in range(N):
    if fennec[i] <= snuke[i]:
        F+=1
    else:
        S+=1
if F>S:
    print("Fennec")
else:
    print("Snuke")