Buggy python submission (verdict: Time Limit Exceeded):
import sys
sys.setrecursionlimit(10**6)
input=sys.stdin.readline
from collections import deque
N=int(input())

graph=[[] for _ in range(N+1)]
for _ in range(N-1):
  a,b=map(int,input().split())
  graph[a].append(b)
  graph[b].append(a)
#print(graph)

def dfs_init(u,ls):
  global path
  visited[u]=True  
  if u==N:
    path=ls
    return
  
  for v in graph[u]:
    if not visited[v]:
      dfs_init(v,ls+[v])
  
path=[]  
visited=[False]*(N+1)
dfs_init(1,[1])
#print(path)

visited=[False]*(N+1)
set_f=set()
set_s=set()
turn=1
dq=deque(path)
while dq:
  #Fenec
  node_f=dq.popleft()
  visited[node_f]=True
  set_f.add(node_f)
  turn=-1
  
  if dq:
    #Snuke
    node_s=dq.pop()
    visited[node_s]=True
    set_s.add(node_s)
    turn=1
#print(set_f,set_s,visited,turn)

def dfs_fenec(u):
  global cnt_f
  if not visited[u]:
    visited[u]=True
    cnt_f+=1
  for v in graph[u]:
    if not visited[v]:
      dfs_fenec(v)

def dfs_snuke(u):
  global cnt_s
  if not visited[u]:
    visited[u]=True
    cnt_s+=1
  for v in graph[u]:
    if not visited[v]:
      dfs_snuke(v)
      
#fenec
cnt_f=0
for f in set_f:
  dfs_fenec(f)
  
#snuke
cnt_s=0
for s in set_s:
  dfs_snuke(s)
  
#print(cnt_f,cnt_s)
if turn==1:
  if cnt_f>cnt_s:
    print("Fennec")
  else:
    print("Snuke")
elif turn==-1:
  if cnt_f>=cnt_s:
    print("Fennec")
  else:
    print("Snuke")

Fixed submission:
import sys
sys.setrecursionlimit(10**6)
input=sys.stdin.readline
from collections import deque
N=int(input())

graph=[[] for _ in range(N+1)]
for _ in range(N-1):
  a,b=map(int,input().split())
  graph[a].append(b)
  graph[b].append(a)
#print(graph)

dist_f=[-1]*(N+1)
d=0
queue=[1]
while queue:  
  new_queue=set()
  for u in queue:
    dist_f[u]=d
    for v in graph[u]:
      if dist_f[v]==-1:
        new_queue.add(v)
        
  queue=list(new_queue)
  d+=1
#print(dist_f)

dist_s=[-1]*(N+1)
d=0
queue=[N]
while queue:  
  new_queue=set()
  for u in queue:
    dist_s[u]=d
    for v in graph[u]:
      if dist_s[v]==-1:
        new_queue.add(v)
        
  queue=list(new_queue)
  d+=1
#print(dist_s)

cnt_f,cnt_s=0,0
for i in range(1,N+1):
  if dist_f[i]<=dist_s[i]:
    cnt_f+=1
  else:
    cnt_s+=1

#print(cnt_f,cnt_s)
if cnt_f>cnt_s:
  print("Fennec")
else:
  print("Snuke")

Buggy python submission (verdict: Runtime Error):
import sys
input=sys.stdin.readline
from collections import deque
N=int(input())

graph=[[] for _ in range(N+1)]
for _ in range(N-1):
  a,b=map(int,input().split())
  graph[a].append(b)
  graph[b].append(a)
#print(graph)

def dfs_init(u,ls):
  global path
  visited[u]=True  
  if u==N:
    path=ls
    return
  
  for v in graph[u]:
    if not visited[v]:
      dfs_init(v,ls+[v])
  
path=[]  
visited=[False]*(N+1)
dfs_init(1,[1])
#print(path)

visited=[False]*(N+1)
set_f=set()
set_s=set()
turn=1
dq=deque(path)
while dq:
  #Fenec
  node_f=dq.popleft()
  visited[node_f]=True
  set_f.add(node_f)
  turn=-1
  
  if dq:
    #Snuke
    node_s=dq.pop()
    visited[node_s]=True
    set_s.add(node_s)
    turn=1
#print(set_f,set_s,visited,turn)

def dfs_fenec(u):
  global cnt_f
  if not visited[u]:
    visited[u]=True
    cnt_f+=1
  for v in graph[u]:
    if not visited[v]:
      dfs_fenec(v)

def dfs_snuke(u):
  global cnt_s
  if not visited[u]:
    visited[u]=True
    cnt_s+=1
  for v in graph[u]:
    if not visited[v]:
      dfs_snuke(v)
      
#fenec
cnt_f=0
for f in set_f:
  dfs_fenec(f)
  
#snuke
cnt_s=0
for s in set_s:
  dfs_snuke(s)
  
#print(cnt_f,cnt_s)
if turn==1:
  if cnt_f>cnt_s:
    print("Fennec")
  else:
    print("Snuke")
elif turn==-1:
  if cnt_f>=cnt_s:
    print("Fennec")
  else:
    print("Snuke")

Fixed submission:
import sys
sys.setrecursionlimit(10**6)
input=sys.stdin.readline
from collections import deque
N=int(input())

graph=[[] for _ in range(N+1)]
for _ in range(N-1):
  a,b=map(int,input().split())
  graph[a].append(b)
  graph[b].append(a)
#print(graph)

dist_f=[-1]*(N+1)
d=0
queue=[1]
while queue:  
  new_queue=set()
  for u in queue:
    dist_f[u]=d
    for v in graph[u]:
      if dist_f[v]==-1:
        new_queue.add(v)
        
  queue=list(new_queue)
  d+=1
#print(dist_f)

dist_s=[-1]*(N+1)
d=0
queue=[N]
while queue:  
  new_queue=set()
  for u in queue:
    dist_s[u]=d
    for v in graph[u]:
      if dist_s[v]==-1:
        new_queue.add(v)
        
  queue=list(new_queue)
  d+=1
#print(dist_s)

cnt_f,cnt_s=0,0
for i in range(1,N+1):
  if dist_f[i]<=dist_s[i]:
    cnt_f+=1
  else:
    cnt_s+=1

#print(cnt_f,cnt_s)
if cnt_f>cnt_s:
  print("Fennec")
else:
  print("Snuke")