Buggy python submission (verdict: Runtime Error):
def dia(Node,i,j):
	lst = []
	Node.remove(i)
	if(len(Node) == 0):
		lst.append(1)
	else:
		for n in Node:
			t = dia(A[n],j,n)
			lst.append(t+1)
	return max(lst)
		
N = input()
A = [[] for i in range(N)]
for i in range(N-1):
	a2,b2 = map(int, raw_input().split())
	A[a2-1].append(b2-1)
	A[b2-1].append(a2-1)
lst = []
for n in A[0]:
	lst.append(dia(A[n],0,n))
m1 = max(lst)
lst.remove(m1)
if(len(lst) == 0):
	m2 = 1
else:
	m2 = max(lst)+1
if((m1 + m2) % 3 == 2):
	print("Second")
else:
	print("First")

Fixed submission:
from collections import deque
def dia(i):
	lst = [-1]*N
	lst[i] = 0
	q = deque([i])
	while q:
		c = q.popleft()
		l = lst[c]
		for i in A[c]:
			if lst[i] != -1:
				continue
			else:
				lst[i] = l+1
				q.append(i)
	return lst.index(max(lst))
def dia2(i):
	lst = [-1]*N
	lst[i] = 0
	q = deque([i])
	while q:
		c = q.popleft()
		l = lst[c]
		for i in A[c]:
			if lst[i] != -1:
				continue
			else:
				lst[i] = l+1
				q.append(i)
	return max(lst)+1
N = input()
A = [[] for i in range(N)]
for i in range(N-1):
	a2,b2 = map(int, raw_input().split())
	A[a2-1].append(b2-1)
	A[b2-1].append(a2-1)
if((dia2(dia(0))) % 3 == 2):
	print("Second")
else:
	print("First")

Buggy python submission (verdict: Runtime Error):
def dia(Node):
	lst = []
	if(len(Node) == 0):
		lst.append(1)
	else:
		for n in Node:
			t = dia(d[n])
			lst.append(t+1)
	return max(lst)
		
N = input()
A = []
for i in range(N-1):
	a2,b2 = map(int, raw_input().split())
	if(a2 > b2):
		a2,b2 = b2,a2
	k = [a2,b2]
	A.append(k)
root = A[0][0]
rootd = [A[0][1]]
d = {A[0][0]:[A[0][1]],A[0][1]:[]}
A.pop(0)
for a2 in A:
	if(a2[0] in d):
		t = d[a2[0]]
		n = a2[1]
	elif(a2[1] in d):
		t = d[a2[1]]
		n = a2[0]
	else:
		A.append(a2)
		continue
	t.append(n)
	d[n] = []
lst = []
for n in d[root]:
	lst.append(dia(d[n]))
m1 = max(lst)
lst.remove(m1)
if(len(lst) == 0):
	m2 = 1
else:
	m2 = max(lst)+1
if((m1 + m2) % 3 == 2):
	print("Second")
else:
	print("First")

Fixed submission:
from collections import deque
def dia(i):
	lst = [-1]*N
	lst[i] = 0
	q = deque([i])
	while q:
		c = q.popleft()
		l = lst[c]
		for i in A[c]:
			if lst[i] != -1:
				continue
			else:
				lst[i] = l+1
				q.append(i)
	return lst.index(max(lst))
def dia2(i):
	lst = [-1]*N
	lst[i] = 0
	q = deque([i])
	while q:
		c = q.popleft()
		l = lst[c]
		for i in A[c]:
			if lst[i] != -1:
				continue
			else:
				lst[i] = l+1
				q.append(i)
	return max(lst)+1
N = input()
A = [[] for i in range(N)]
for i in range(N-1):
	a2,b2 = map(int, raw_input().split())
	A[a2-1].append(b2-1)
	A[b2-1].append(a2-1)
if((dia2(dia(0))) % 3 == 2):
	print("Second")
else:
	print("First")

Buggy python submission (verdict: Runtime Error):
def dia(Node):
	lst = []
	if(len(Node) == 0):
		lst.append(1)
	else:
		for n in Node:
			t = dia(d[n])
			lst.append(t+1)
	return max(lst)
		
N = input()
A = []
for i in range(N-1):
	a2,b2 = map(int, raw_input().split())
	if(a2 > b2):
		a2,b2 = b2,a2
	k = [a2,b2]
	A.append(k)
root = A[0][0]
rootd = [A[0][1]]
d = {A[0][0]:[A[0][1]],A[0][1]:[]}
for i in range(1,N-1):
	if(A[i][0] in d):
		t = d[A[i][0]]
		n = A[i][1]
	elif(A[i][1] in d):
		t = d[A[i][1]]
		n = A[i][0]
	t.append(n)
	d[n] = []
lst = []
for n in d[root]:
	lst.append(dia(d[n]))
m1 = max(lst)
lst.remove(m1)
if(len(lst) == 0):
	m2 = 1
else:
	m2 = max(lst)+1
if((m1 + m2) % 3 == 2):
	print("Second")
else:
	print("First")

Fixed submission:
from collections import deque
def dia(i):
	lst = [-1]*N
	lst[i] = 0
	q = deque([i])
	while q:
		c = q.popleft()
		l = lst[c]
		for i in A[c]:
			if lst[i] != -1:
				continue
			else:
				lst[i] = l+1
				q.append(i)
	return lst.index(max(lst))
def dia2(i):
	lst = [-1]*N
	lst[i] = 0
	q = deque([i])
	while q:
		c = q.popleft()
		l = lst[c]
		for i in A[c]:
			if lst[i] != -1:
				continue
			else:
				lst[i] = l+1
				q.append(i)
	return max(lst)+1
N = input()
A = [[] for i in range(N)]
for i in range(N-1):
	a2,b2 = map(int, raw_input().split())
	A[a2-1].append(b2-1)
	A[b2-1].append(a2-1)
if((dia2(dia(0))) % 3 == 2):
	print("Second")
else:
	print("First")