Buggy python submission (verdict: Time Limit Exceeded):
import sys
sys.setrecursionlimit(10**6)

n = int(input())
e = [[] for _ in range(n)]

for i in range(n-1):
    a, b = [int(item) for item in input().split()]
    e[a-1].append(b-1)
    e[b-1].append(a-1)

shortest = []
def get_path(start, end, par, path):
    global shortest
    if end in e[start]:
        shortest = path + [end]
        return True
    for item in e[start]:
        if item != par:
             if get_path(item, end, start, path + [item]):
                 return True

def tree_count(start, par, a, b):
    count = 0
    for item in e[start]:
        if start == a and item == b:
            continue
        if start == b and item == a:
            continue
        if item != par:
            count += 1
            count += tree_count(item, start, a, b)
    return count

get_path(0, n-1, -1, [0])
cut_l = (len(shortest)-1) // 2
p = tree_count(0, -1, shortest[cut_l], shortest[cut_l+1])
q = n - p - 2 
if p > q:
    print("Fennec")
else:
    print("Snuke")

Fixed submission:
import sys
sys.setrecursionlimit(10**6)

n = int(input())
e = [[] for _ in range(n)]

for i in range(n-1):
    a, b = [int(item) for item in input().split()]
    e[a-1].append(b-1)
    e[b-1].append(a-1)

shortest = []
def get_path(start, end, par):
    if end in e[start]:
        shortest.append(end)
        return True
    for item in e[start]:
        if item != par:
             if get_path(item, end, start):
                 shortest.append(item)
                 return True

def tree_count(start, par, a, b):
    count = 0
    for item in e[start]:
        if start == a and item == b:
            continue
        if start == b and item == a:
            continue
        if item != par:
            count += 1
            count += tree_count(item, start, a, b)
    return count

get_path(0, n-1, -1)
shortest.append(0)
shortest = shortest[::-1]
cut_l = (len(shortest)-1) // 2
p = tree_count(0, -1, shortest[cut_l], shortest[cut_l+1])
q = n - p - 2 
if p > q:
    print("Fennec")
else:
    print("Snuke")

Buggy python submission (verdict: Time Limit Exceeded):
import sys
sys.setrecursionlimit(10**6)

n = int(input())
ab = [[int(item) for item in input().split()] for _ in range(n-1)]

e = [[] for _ in range(n)]
for a, b in ab:
    e[a-1].append(b-1)
    e[b-1].append(a-1)

shortest = []
def get_path(start, end, par, path):
    global shortest
    if end in e[start]:
        shortest = path + [end]
        return True
    for item in e[start]:
        if item != par:
             get_path(item, end, start, path + [item])

def tree_count(start, par, a, b):
    count = 0
    for item in e[start]:
        if start == a and item == b:
            continue
        if start == b and item == a:
            continue
        if item != par:
            count += 1
            count += tree_count(item, start, a, b)
    return count

get_path(0, n-1, -1, [0])
cut_l = (len(shortest)-1) // 2
p = tree_count(0, -1, shortest[cut_l], shortest[cut_l+1])
q = n - p - 2 
if p > q:
    print("Fennec")
else:
    print("Snuke")

Fixed submission:
import sys
sys.setrecursionlimit(10**6)

n = int(input())
e = [[] for _ in range(n)]

for i in range(n-1):
    a, b = [int(item) for item in input().split()]
    e[a-1].append(b-1)
    e[b-1].append(a-1)

shortest = []
def get_path(start, end, par):
    if end in e[start]:
        shortest.append(end)
        return True
    for item in e[start]:
        if item != par:
             if get_path(item, end, start):
                 shortest.append(item)
                 return True

def tree_count(start, par, a, b):
    count = 0
    for item in e[start]:
        if start == a and item == b:
            continue
        if start == b and item == a:
            continue
        if item != par:
            count += 1
            count += tree_count(item, start, a, b)
    return count

get_path(0, n-1, -1)
shortest.append(0)
shortest = shortest[::-1]
cut_l = (len(shortest)-1) // 2
p = tree_count(0, -1, shortest[cut_l], shortest[cut_l+1])
q = n - p - 2 
if p > q:
    print("Fennec")
else:
    print("Snuke")

Buggy python submission (verdict: Time Limit Exceeded):
import sys
sys.setrecursionlimit(10**6)

n = int(input())
ab = [[int(item) for item in input().split()] for _ in range(n-1)]

e = [[] for _ in range(n)]
for a, b in ab:
    e[a-1].append(b-1)
    e[b-1].append(a-1)

shortest = []
def get_path(start, end, par, path):
    global shortest
    if end in e[start]:
        shortest = path + [end]
        return True
    for item in e[start]:
        if item != par:
             get_path(item, end, start, path + [item])

def tree_count(start, par, a, b):
    count = 0
    for item in e[start]:
        if start == a and item == b:
            continue
        if start == b and item == a:
            continue
        if item != par:
            count += 1
            count += tree_count(item, start, a, b)
    return count

get_path(0, n-1, -1, [0])
cut_l = (len(shortest)-1) // 2
p = tree_count(0, -1, shortest[cut_l], shortest[cut_l+1])
q = tree_count(n-1, -1, shortest[cut_l], shortest[cut_l+1])

if p > q:
    print("Fennec")
else:
    print("Snuke")

Fixed submission:
import sys
sys.setrecursionlimit(10**6)

n = int(input())
e = [[] for _ in range(n)]

for i in range(n-1):
    a, b = [int(item) for item in input().split()]
    e[a-1].append(b-1)
    e[b-1].append(a-1)

shortest = []
def get_path(start, end, par):
    if end in e[start]:
        shortest.append(end)
        return True
    for item in e[start]:
        if item != par:
             if get_path(item, end, start):
                 shortest.append(item)
                 return True

def tree_count(start, par, a, b):
    count = 0
    for item in e[start]:
        if start == a and item == b:
            continue
        if start == b and item == a:
            continue
        if item != par:
            count += 1
            count += tree_count(item, start, a, b)
    return count

get_path(0, n-1, -1)
shortest.append(0)
shortest = shortest[::-1]
cut_l = (len(shortest)-1) // 2
p = tree_count(0, -1, shortest[cut_l], shortest[cut_l+1])
q = n - p - 2 
if p > q:
    print("Fennec")
else:
    print("Snuke")

Buggy python submission (verdict: Runtime Error):
n = int(input())
ab = [[int(item) for item in input().split()] for _ in range(n-1)]

e = [[] for _ in range(n)]
for a, b in ab:
    e[a-1].append(b-1)
    e[b-1].append(a-1)

shortest = []
def get_path(start, end, par, path):
    global shortest
    if end in e[start]:
        shortest = path + [end]
        return shortest
    for item in e[start]:
        if item != par:
             get_path(item, end, start, path + [item])

def tree_count(start, par, a, b):
    count = 0
    for item in e[start]:
        if start == a and item == b:
            continue
        if start == b and item == a:
            continue
        if item != par:
            count += 1
            count += tree_count(item, start, a, b)
    return count

get_path(0, n-1, -1, [0])
cut_l = (len(shortest)-1) // 2
p = tree_count(0, -1, shortest[cut_l], shortest[cut_l+1])
q = tree_count(n-1, -1, shortest[cut_l], shortest[cut_l+1])

if p > q:
    print("Fennec")
else:
    print("Sunuke")

Fixed submission:
import sys
sys.setrecursionlimit(10**6)

n = int(input())
e = [[] for _ in range(n)]

for i in range(n-1):
    a, b = [int(item) for item in input().split()]
    e[a-1].append(b-1)
    e[b-1].append(a-1)

shortest = []
def get_path(start, end, par):
    if end in e[start]:
        shortest.append(end)
        return True
    for item in e[start]:
        if item != par:
             if get_path(item, end, start):
                 shortest.append(item)
                 return True

def tree_count(start, par, a, b):
    count = 0
    for item in e[start]:
        if start == a and item == b:
            continue
        if start == b and item == a:
            continue
        if item != par:
            count += 1
            count += tree_count(item, start, a, b)
    return count

get_path(0, n-1, -1)
shortest.append(0)
shortest = shortest[::-1]
cut_l = (len(shortest)-1) // 2
p = tree_count(0, -1, shortest[cut_l], shortest[cut_l+1])
q = n - p - 2 
if p > q:
    print("Fennec")
else:
    print("Snuke")