Buggy python submission (verdict: Runtime Error):
n = int(input())

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

f = [[0], []]
f[1] = [] + p[0]
if n - 1 in f[1]:
    f[1].remove(n - 1)
    if len(f[1]) == 0:
        print("Snuke")
    else:
        print("Fennec")
    exit()

s = [[n - 1], []]
s[1] = [] + p[n - 1]

d = 1
check = 0
check_f = 0
check_s = 0

while 1:
    if check_f == 0:
        temp_f = []
        for i in f[d]:
            temp_f = temp_f + p[i]
        temp_f = list(set(temp_f))
        if n - 1 in temp_f:
            temp_f.remove(n - 1)
        for i in f[d - 1]:
            if i in temp_f:
                temp_f.remove(i)
        if len(temp_f) > 0:
            f.append([])
            f[d + 1] = [] + temp_f
        else:
            check_f = 1
    else:
        if check_s != 0:
            break

    if check_s == 0:
        temp_s = []
        for i in s[d]:
            temp_s = temp_s + p[i]
        temp_s = list(set(temp_s))
        if 0 in temp_s:
            temp_s.remove(0)
        for i in s[d - 1]:
            if i in temp_s:
                temp_s.remove(i)
        if len(temp_s) > 0:
            s.append([])
            s[d + 1] = [] + temp_s
        else:
            check_s = 1

    if check == 0:
        for i in temp_f:
            if i in temp_s:
                temp_s.remove[i]
                check = 1

    d += 1

fe = sum(len(v) for v in f)

sn = sum(len(v) for v in s)

if fe > sn:
    print("Fennec")
else:
    print("Snuke")

Fixed submission:
n = int(input())

p = [[] for _ in range(n)]
for i in range(n - 1):
    x, y = map(int, input().split())
    p[x - 1].append(y - 1)
    p[y - 1].append(x - 1)

f = [n for _ in range(n)]
s = [n for _ in range(n)]

f[0] = 0
after = [] + p[0]
before = set()
dist = 0
while 1:
    dist += 1
    check = 0
    temp = []
    for x in after:
        if f[x] == n:
            f[x] = dist
            temp += p[x]
            check = 1
    if check == 0:
        break
    t2 = set(temp) - before
    before = set(after)
    after = list(t2)

s[n - 1] = 0
after = [] + p[n - 1]
before = set()
dist = 0
while 1:
    dist += 1
    check = 0
    temp = []
    for x in after:
        if s[x] == n:
            s[x] = dist
            temp += p[x]
            check = 1
    if check == 0:
        break
    t2 = set(temp) - before
    before = set(after)
    after = list(t2)

score_f = 0
for i in range(n):
    if f[i] <= s[i]:
        score_f += 1

if score_f > n - score_f:
    print('Fennec')
else:
    print('Snuke')

Buggy python submission (verdict: Time Limit Exceeded):
n = int(input())

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

f = [[0], []]
d = 1

f[1] = f[1] + p[0]

while 1:
    if n - 1 in f[d]:
        break
    temp = []
    for i in f[d]:
        temp = [] + p[i]
    temp = list(set(temp))
    f.append([])
    d += 1
    f[d] = [] + temp

route = [n - 1]
t = n - 1
for i in range(d, 0, -1):
    for j in f[i - 1]:
        if t in p[j]:
            t = j
            route.append(t)

#print(f)
#print(route)

mid = route[ len(route) // 2 - 1 ]

#print(mid)

f = [[0], []]
d = 1

f[1] = f[1] + p[0]

check = 1
if mid in f[1]:
    f[1].remove(mid)
    if len(f[1]) == 0:
        check = 0

while check:
    temp = []
    for i in f[d]:
        temp = [] + p[i]
    temp = list(set(temp))
    if mid in temp:
        temp.remove(mid)
    for i in f[d - 1]:
        if i in temp:
            temp.remove(i)
    if len(temp) == 0:
        break
    f.append([])
    d += 1
    f[d] = [] + temp

fe = sum(len(v) for v in f)

mid = route[ len(route) // 2 ]

f = [[n - 1], []]
d = 1

f[1] = f[1] + p[n - 1]

check = 1
if mid in f[1]:
    f[1].remove(mid)
    if len(f[1]) == 0:
        check = 0

while check:
    temp = []
    for i in f[d]:
        temp = [] + p[i]
    temp = list(set(temp))
    if mid in temp:
        temp.remove(mid)
    for i in f[d - 1]:
        if i in temp:
            temp.remove(i)
    if len(temp) == 0:
        break
    f.append([])
    d += 1
    f[d] = [] + temp

sn = sum(len(v) for v in f)

if fe > sn:
    print("Fennec")
else:
    print("Snuke")

Fixed submission:
n = int(input())

p = [[] for _ in range(n)]
for i in range(n - 1):
    x, y = map(int, input().split())
    p[x - 1].append(y - 1)
    p[y - 1].append(x - 1)

f = [n for _ in range(n)]
s = [n for _ in range(n)]

f[0] = 0
after = [] + p[0]
before = set()
dist = 0
while 1:
    dist += 1
    check = 0
    temp = []
    for x in after:
        if f[x] == n:
            f[x] = dist
            temp += p[x]
            check = 1
    if check == 0:
        break
    t2 = set(temp) - before
    before = set(after)
    after = list(t2)

s[n - 1] = 0
after = [] + p[n - 1]
before = set()
dist = 0
while 1:
    dist += 1
    check = 0
    temp = []
    for x in after:
        if s[x] == n:
            s[x] = dist
            temp += p[x]
            check = 1
    if check == 0:
        break
    t2 = set(temp) - before
    before = set(after)
    after = list(t2)

score_f = 0
for i in range(n):
    if f[i] <= s[i]:
        score_f += 1

if score_f > n - score_f:
    print('Fennec')
else:
    print('Snuke')