Problem:
Score : 800 points

Problem Statement

Takahashi and Aoki will play a game on a tree.
The tree has N vertices numbered 1 to N, and the i-th of the N-1 edges connects Vertex a_i and Vertex b_i.

At the beginning of the game, each vertex contains a coin.
Starting from Takahashi, he and Aoki will alternately perform the following operation:

Choose a vertex v that contains one or more coins, and remove all the coins from v.

Then, move each coin remaining on the tree to the vertex that is nearest to v among the adjacent vertices of the coin's current vertex.

The player who becomes unable to play, loses the game.
That is, the player who takes his turn when there is no coin remaining on the tree, loses the game.
Determine the winner of the game when both players play optimally.

Constraints

1 \leq N \leq 2 \times 10^5

1 \leq a_i, b_i \leq N

a_i \neq b_i

The graph given as input is a tree.

Input

Input is given from Standard Input in the following format:

N
a_1 b_1
a_2 b_2
:
a_{N-1} b_{N-1}

Output

Print First if Takahashi will win, and print Second if Aoki will win.

Sample Input 1

3
1 2
2 3

Sample Output 1

First

Here is one possible progress of the game:

Takahashi removes the coin from Vertex 1. Now, Vertex 1 and Vertex 2 contain one coin each.

Aoki removes the coin from Vertex 2. Now, Vertex 2 contains one coin.

Takahashi removes the coin from Vertex 2. Now, there is no coin remaining on the tree.

Aoki takes his turn when there is no coin on the tree and loses.

Sample Input 2

6
1 2
2 3
2 4
4 6
5 6

Sample Output 2

Second

Sample Input 3

7
1 7
7 4
3 4
7 5
6 3
2 1

Sample Output 3

First

Solution in C++14 (Clang 3.8.0) (judge verdict: Accepted)

//
//  main.cpp
//
 
#include <algorithm>
#include <array>
#include <assert.h>
#include <functional>
#include <iostream>
#include <iomanip>
#include <limits>
#include <map>
#include <math.h>
#include <memory>
#include <queue>
#include <random>
#include <set>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <string>
#include <tuple>
#include <unordered_map>
#include <unordered_set>
#include <vector>
 
using namespace std;
 
using ll = long long;
using ull = unsigned long long;
 
template<typename T>
vector<T> make_vec_nd(T init, size_t size) {
	return vector<T>(size, init);
}
template<typename T, typename... Args>
auto make_vec_nd(T init, size_t size, Args... rest) {
	auto inner = make_vec_nd(init, rest...);
	return vector<decltype(inner)>(size, inner);
}

#define rep(i,a,b) for(ll i=a;i<b;i++)
#define rrep(i,a,b) for(ll i=a-1;i>=b;i--)

struct Edge {
	ll from;
	ll to;
};

ll max_path(const vector<vector<Edge>>& graph, ll v, ll* out_depth, vector<bool>& visited) {
	visited[v] = true;
	ll ans = numeric_limits<ll>::min();
	vector<ll> depths;
	for (Edge e : graph[v]) {
		if (visited[e.to]) {
			continue;
		}
		ll mp, depth;
		mp = max_path(graph, e.to, &depth, visited);
		ans = max(ans, mp);
		depths.push_back(depth);
	}
	if (depths.size() >= 2) {
		sort(depths.rbegin(), depths.rend());
		ans = max(ans, depths[0] + depths[1] + 2);
		*out_depth = depths[0] + 1;
	} else if (depths.size() == 1) {
		ans = max(ans, depths[0] + 1);
		*out_depth = depths[0] + 1;
	} else {
		ans = max(ans, (ll)0);
		*out_depth = 0;
	}
	return ans;
}

int main() {
	ll N;
	cin >> N;
	vector<vector<Edge>> graph(N);
	rep(i,0,N-1) {
		ll A, B;
		cin >> A >> B;
		A--;
		B--;
		graph[A].push_back({A, B});
		graph[B].push_back({B, A});
	}
	vector<bool> visited(N);
	ll depth;
	ll len = max_path(graph, 0, &depth, visited);
	// cout << len << endl;
	// cout << depth << endl;
	if (len % 3 == 1) {
		cout << "Second" << endl;
	} else {
		cout << "First" << endl;
	}
}