stablegradients/pie-gem5-pairs huggingface dataset:
// Slower C++ solution:
#include <bits/stdc++.h>

using namespace std;

#define ll long long

const int N=500005;

int head[N];

int to[N];

int edge[N];

int Next[N];

int cnt;



void add(int x,int y){

    to[++cnt]=y;

    Next[cnt]=head[x];

    head[x]=cnt;

}



ll ans;

int d[N];

bool vis[N];

void dfs(int x){

    vis[x]=1;

    for(int i=head[x];i;i=Next[i]){

        int y=to[i];

        if(vis[y])continue;

        d[y]=d[x]+1;

        if(d[y]>d[ans])ans=y;

        dfs(y);

    }

}

int x,y;

int main(){

    int n;

    ans=0;

    d[0]=0;

    cin >> n;

    for(int i=1;i<n;++i){

        cin>>x>>y;

        add(x,y);

        add(y,x);

    }

    dfs(1);

    memset(d,0,sizeof(d));

    memset(vis,0,sizeof(vis));

    dfs(ans);

    if(d[ans]%3==1) cout << "Second" << endl;

    else cout << "First" << endl;

    return 0;

}


// Faster C++ solution for the same problem (measured speedup: 3.5404972661589x):
#include <cstdio>

#include <cstring>

#include <algorithm>

using namespace std;

const int SIZEN = 200100;

struct Link{

	int to,next;

}link[SIZEN<<2];

int head[SIZEN],tot = 0;

void add(int from,int to){link[++tot].to = to;link[tot].next = head[from];head[from] = tot;}

int N;

int dis[SIZEN] = {0},root = 1;

int F[SIZEN] = {0};

void DFS(int x,int fa){

	for(int i = head[x];i;i=link[i].next){

		if(link[i].to == fa)continue;

		dis[link[i].to] = dis[x] + 1;

		DFS(link[i].to,x);

	}

	if(dis[root] < dis[x])root = x;

}



int main(){

	scanf("%d",&N);

	for(int i = 1;i < N;i++){

		int a,b;

		scanf("%d%d",&a,&b);

		add(a,b);

		add(b,a);

	}

	DFS(root,0);

	memset(dis,0,sizeof dis);

	DFS(root,0);

	int len = 0;

	for(int i = 1;i <= N;i++)len = max(len,dis[i]);

	F[1] = 1;F[2] = 0;

	for(int i = 3;i <= len + 1;i++)F[i] = F[i-1] ^ F[i-2];

//	printf("%d\n",len+1);

	if(F[len + 1])printf("First");

	else printf("Second");

	return 0; 

}
// Slower C++ solution:
#include <bits/stdc++.h>

#define rep(i,n) for(int i=0;i<n;i++)

using namespace std;

typedef long long ll;

const int inf=1<<30;



int n,a,b,x,d[200009];

vector<int> e[200009];



int bfs(int s){

    rep(i,n+1)d[i]=inf;

    d[s]=0;

    queue<int> que;

    que.push(s);

    int now;

    while(!que.empty()){

        now=que.front();

        que.pop();

        rep(i,e[now].size()){

            if(d[e[now][i]]!=inf)continue;

            d[e[now][i]]=d[now]+1;

            que.push(e[now][i]);

        }

    }

    x=now;

    return d[now];

}



int main(){

    cin>>n;

    rep(i,n-1){

        cin>>a>>b;

        e[a].push_back(b);

        e[b].push_back(a);

    }

    bfs(1);

    cout<<(bfs(x)%3!=1?"First\n":"Second\n");

}

// Faster C++ solution for the same problem (measured speedup: 6.351450707770028x):
#include <bits/stdc++.h>

#define FOR(i, a, n) for(ll i = (ll)a; i < (ll)n; i++)

#define FORR(i, n) for(ll i = (ll)n - 1LL; i >= 0LL; i--)

#define rep(i, n) FOR(i, 0, n)

#define ALL(x) (x).begin(), (x).end()

using namespace std;

using ll = long long;

template <typename T> using V = vector<T>;



constexpr int Mod = 998244353;

constexpr int mod = 1e9 + 7;

constexpr ll inf = 1LL << 60;



template <typename T> constexpr bool chmax(T &a, const T &b) {

    if(a >= b) return false;

    a = b;

    return true;

}

template <typename T> constexpr bool chmin(T &a, const T &b) {

    if(a <= b) return false;

    a = b;

    return true;

}



/*-------------------------------------------*/



int chokkei(const V<V<int>> &G) {

    int n = G.size();

    V<int> d(n, -1);

    d[0] = 0;

    queue<int> que;

    que.push(0);

    int v;

    while(!que.empty()) {

        v = que.front();

        que.pop();

        for(int u : G[v]) {

            if(d[u] == -1) {

                d[u] = d[v] + 1;

                que.push(u);

            }

        }

    }

    d.assign(n, -1);

    d[v] = 0;

    que.push(v);

    while(!que.empty()) {

        v = que.front();

        que.pop();

        for(int u : G[v]) {

            if(d[u] == -1) {

                d[u] = d[v] + 1;

                que.push(u);

            }

        }

    }

    return d[v];

}



int main() {

    cin.tie(0);

    ios::sync_with_stdio(0);



    int n;

    cin >> n;

    V<V<int>> G(n);

    rep(i, n - 1) {

        int a, b;

        cin >> a >> b;

        a--;

        b--;

        G[a].push_back(b);

        G[b].push_back(a);

    }

    puts(chokkei(G) % 3 == 1 ? "Second" : "First");



    return 0;

}
// Slower C++ solution:
//order_of_key(k): Number of items strictly smaller than k .

//find_by_order(k): K-th element in a set (counting from zero).

#include <bits/stdc++.h>

#include <ext/pb_ds/assoc_container.hpp>



#define full(x,n) x,x+n+1

#define full(x) x.begin(),x.end()

#define finish return 0



#define putb push_back

#define f first

#define s second



//logx(a^n)=loga(a^n)/logx(a)

//logx(a*b)=logx(a)+logx(b)

//logx(y)=log(y)/log(x)



#define ordered_set tree<ll,null_type,less<int>,rb_tree_tag,tree_order_statistics_node_update>

#define putf push_front

#define gainb pop_back



#define gainf pop_front

#define len(x) (ll)x.size()



// 1/b%mod=b^(m-2)%mod

// (a>>x)&1==0



typedef double db;

typedef long long ll;



const ll ary=2e5+5;

const ll mod=1e9+7;

const ll inf=1e18;



using namespace std;

using namespace __gnu_pbds;

ll n,mx,x,y,nv1,nv2;

vector<ll> g[ary],q;

void dfs(ll v,ll d=0,ll p=0){

	q.putb(v);

	if(d>mx){

		if(len(q)%2){

			nv1=nv2=q[len(q)/2];

		}

		else{

			nv1=q[len(q)/2-1];

			nv2=q[len(q)/2];

		}

		y=v;

		mx=d;

	}

	for(int i=0;i<len(g[v]);i++){

		ll to=g[v][i];

		if(to==p){

			continue;

		}

		dfs(to,d+1,v);

	}

	q.gainb();

}

int main(){

	ios_base::sync_with_stdio(0);

	cin.tie(0);cout.tie(0);

	cin>>n;

	for(int i=1;i<n;i++){

		ll a,b;

		cin>>a>>b;

		g[a].putb(b);

		g[b].putb(a);

	}

	dfs(1);

	mx=0;

	dfs(y);

	if(mx%3==1){

		cout<<"Second";

		return 0;

	}

	cout<<"First";

}

// Faster C++ solution for the same problem (measured speedup: 6.541124114816035x):
#include<bits/stdc++.h> 

const int maxn=202020;

struct Edge{

	int to;

	int last;

}a[maxn<<1];

int n,m;

int tot;

int d[maxn];

int head[maxn];

inline void HA(int x,int y)

{

	a[++tot]={y,head[x]};

	head[x]=tot;

	a[++tot]={x,head[y]};

	head[y]=tot;

}

#define y a[i].to

inline void Dfs(int x,int prt){

	for(int i=head[x];i;i=a[i].last)

		if(y!=prt)d[y]=d[x]+1,Dfs(y,x);

	if(d[x]>d[m])m=x;

}

#undef y

int main()

{

	scanf("%d",&n);

	for(int i=1,x,y;i<n;++i)

	{

		scanf("%d%d",&x,&y);

		HA(x,y);

	}

	m=0,Dfs(1,0);

	int temp=m;d[m]=0;

	m=0,Dfs(temp,0);

	puts(d[m]%3==1 ? "Second" : "First");

	return 0;

}
// Slower C++ solution:
//#pragma GCC target("avx2")

//#pragma GCC optimize("O3")

   

//#include <x86intrin.h>

#include <bits/stdc++.h>   

#include <ext/pb_ds/assoc_container.hpp>

#include <ext/pb_ds/tree_policy.hpp>

 

using namespace __gnu_pbds;

using namespace std;



template<typename T> using ordered_set = tree <T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;

     

#define F first

#define S second           

#define lb lower_bound               

#define ub upper_bound

#define pb push_back

#define pf push_front    

#define ppb pop_back

#define mp make_pair

#define bpp __builtin_popcountll                                                                                        

#define sqr(x) ((x) * (x)) 

#define al 0x3F3F3F3F

#define sz(x) (int)x.size()

#define all(x) x.begin(), x.end()

#define in insert

#define ppf pop_front

#define endl '\n'

//#define int long long

 

typedef unsigned long long ull;

typedef long long ll;

typedef long double ld;

typedef pair <int, int> pii;

 

const int mod = (int)1e9 + 7;

const int N = (int)3e5 + 123;

const ll inf = (ll)1e18 + 1;



const double pi = acos (-1.0);

const double eps = 1e-7;                  

const int dx[] = {0, 0, 1, 0, -1};

const int dy[] = {0, 1, 0, -1, 0};



int n, r, st;

vector <int> g[N];



void dfs (int v, int pr = 0, int lvl = 0) {

   if (r < lvl) r = lvl, st = v;

   for (auto to : g[v])

      if (to != pr)

         dfs (to, v, lvl + 1);



}



inline void boost () {                    

   ios_base :: sync_with_stdio (NULL);

   cin.tie (NULL), cout.tie (NULL);          

}                                                     



inline void Solve () {

   cin >> n;

   for (int i = 1; i < n; i ++) {

      int x, y;

      cin >> x >> y;

      g[x].pb (y);

      g[y].pb (x);

   }

   dfs (1);

   r = 0;

   dfs (st);

   cout << (r % 3 == 1 ? "Second" : "First");

}



main () {                                       

// freopen (".in", "r", stdin);    

// freopen (".out", "w", stdout);              

   boost ();

   int tt = 1;

   //cin >> tt;   

   while (tt --) {

      Solve ();

   }                                               

   return 0;      

}

                          

// Faster C++ solution for the same problem (measured speedup: 9.501939137161868x):
#include<bits/stdc++.h> 

const int maxn=202020;

struct Edge{

	int to;

	int last;

}a[maxn<<1];

int n,m;

int tot;

int d[maxn];

int head[maxn];

inline void HA(int x,int y)

{

	a[++tot]={y,head[x]};

	head[x]=tot;

	a[++tot]={x,head[y]};

	head[y]=tot;

}

#define y a[i].to

inline void Dfs(int x,int prt){

	for(int i=head[x];i;i=a[i].last)

		if(y!=prt)d[y]=d[x]+1,Dfs(y,x);

	if(d[x]>d[m])m=x;

}

#undef y

int main()

{

	scanf("%d",&n);

	for(int i=1,x,y;i<n;++i)

	{

		scanf("%d%d",&x,&y);

		HA(x,y);

	}

	m=0,Dfs(1,0);

	int temp=m;d[m]=0;

	m=0,Dfs(temp,0);

	puts(d[m]%3==1 ? "Second" : "First");

	return 0;

}
// Slower C++ solution:
#include <bits/stdc++.h>

using namespace std;

using uint = unsigned int;

using ll = long long;

using ld = long double;

using ull = unsigned long long;

using pii = pair<int, int>;

using pll = pair<ll, ll>;

#define dbg(x) cerr<<#x": "<<(x)<<endl

#define dbg_p(x) cerr<<#x": "<<(x).first<<' '<<(x).second<<endl

#define dbg_v(x, n) {cerr<<#x"[]: ";for(long long _=0;_<n;++_)cerr<<(x)[_]<<' ';cerr<<endl;}

#define all(v) v.begin(), v.end()

#define fi first

#define se second



template<typename T1, typename T2>

ostream& operator <<(ostream &out, const pair<T1, T2> &item) {

	out << '(' << item.first << ", " << item.second << ')';

	return out;

}



template <typename T>

ostream& operator <<(ostream &out, const vector<T>& v) {

	for(const auto &item : v) out << item << ' ';

	return out;

}



const int N = 200010;



int node, dst;

bool win[N];

vector<int> adj[N];



void dfs(int v, int p = -1, int depth = 0) {

	if(depth >= dst) node = v, dst = depth;



	for(auto u : adj[v]) if(u != p) dfs(u, v, depth + 1);

}



int main()

{

	ios_base::sync_with_stdio(false);

	

	int n, a, b;



	win[0] = true;

	for(int i = 1; i < N; ++i) {

		if(!win[i - 1]) win[i] = true;

		else if(i > 1 && !win[i - 2]) win[i] = true;

		else win[i] = false;

	}



	cin >> n;

	for(int i = 1; i < n; ++i) {

		cin >> a >> b;

		adj[a].push_back(b);

		adj[b].push_back(a);

	}



	dfs(1);



	dst = 0;

	dfs(node);



	cout << (win[dst] ? "First" : "Second") << '\n';



	return 0;

}


// Faster C++ solution for the same problem (measured speedup: 7.048512333241819x):
#include<bits/stdc++.h> 

const int maxn=202020;

struct Edge{

	int to;

	int last;

}a[maxn<<1];

int n,m;

int tot;

int d[maxn];

int head[maxn];

inline void HA(int x,int y)

{

	a[++tot]={y,head[x]};

	head[x]=tot;

	a[++tot]={x,head[y]};

	head[y]=tot;

}

#define y a[i].to

inline void Dfs(int x,int prt){

	for(int i=head[x];i;i=a[i].last)

		if(y!=prt)d[y]=d[x]+1,Dfs(y,x);

	if(d[x]>d[m])m=x;

}

#undef y

int main()

{

	scanf("%d",&n);

	for(int i=1,x,y;i<n;++i)

	{

		scanf("%d%d",&x,&y);

		HA(x,y);

	}

	m=0,Dfs(1,0);

	int temp=m;d[m]=0;

	m=0,Dfs(temp,0);

	puts(d[m]%3==1 ? "Second" : "First");

	return 0;

}
// Slower C++ solution:
#include <bits/stdc++.h>

#define st first

#define nd second



using namespace std;



void debug_out() { cerr << endl; }

template<class T> ostream& prnt(ostream& out, T v) { out << v.size() << '\n'; for(auto e : v) out << e << ' '; return out;}

template<class T> ostream& operator<<(ostream& out, vector <T> v) { return prnt(out, v); }

template<class T> ostream& operator<<(ostream& out, set <T> v) { return prnt(out, v); }

template<class T1, class T2> ostream& operator<<(ostream& out, map <T1, T2> v) { return prnt(out, v); }

template<class T1, class T2> ostream& operator<<(ostream& out, pair<T1, T2> p) { return out << '(' << p.st << ' ' << p.nd << ')'; }

template <typename Head, typename... Tail> void debug_out(Head H, Tail... T) { cerr << " " << H; debug_out(T...);}



#define dbg(...) cerr << #__VA_ARGS__ << " ->", debug_out(__VA_ARGS__)

#define dbg_v(x, n) do{cerr<<#x"[]: ";for(int _=0;_<n;++_)cerr<<x[_]<<" ";cerr<<'\n';}while(0)

#define dbg_ok cerr<<"OK!\n"



const int N = 200100;

int n, op, maxd, a, b;

vector <int> v[N];



void dfs(int node, int d = 1, int t = -1) {



	if(d > maxd) {

		maxd = d; 

		op = node;

	}



	for(auto i : v[node])

		if(i != t)

			dfs(i, d + 1, node);

}



int main() {

	ios_base::sync_with_stdio(false);

	cin >> n;

	for(int i = 1; i < n; i++) {

		cin >> a >> b;

		v[a].push_back(b);

		v[b].push_back(a);

	}



	maxd = 0;

	dfs(1);

	maxd = 0;

	dfs(op);

	cout << (maxd % 3 != 2 ? "First" : "Second") << '\n';

}	






// Faster C++ solution for the same problem (measured speedup: 6.549066793113973x):
#include<bits/stdc++.h> 

const int maxn=202020;

struct Edge{

	int to;

	int last;

}a[maxn<<1];

int n,m;

int tot;

int d[maxn];

int head[maxn];

inline void HA(int x,int y)

{

	a[++tot]={y,head[x]};

	head[x]=tot;

	a[++tot]={x,head[y]};

	head[y]=tot;

}

#define y a[i].to

inline void Dfs(int x,int prt){

	for(int i=head[x];i;i=a[i].last)

		if(y!=prt)d[y]=d[x]+1,Dfs(y,x);

	if(d[x]>d[m])m=x;

}

#undef y

int main()

{

	scanf("%d",&n);

	for(int i=1,x,y;i<n;++i)

	{

		scanf("%d%d",&x,&y);

		HA(x,y);

	}

	m=0,Dfs(1,0);

	int temp=m;d[m]=0;

	m=0,Dfs(temp,0);

	puts(d[m]%3==1 ? "Second" : "First");

	return 0;

}
// Slower C++ solution:
#include<bits/stdc++.h>

using namespace std;

typedef long long ll;

#define rep(i, n) for(int i = 0; i < (n); i++)

#define rep1(i, n) for(int i = 1; i <= (n); i++)

#define co(x) cout << (x) << "\n"

#define cosp(x) cout << (x) << " "

#define ce(x) cerr << (x) << "\n"

#define cesp(x) cerr << (x) << " "

#define pb push_back

#define mp make_pair

#define Would

#define you

#define please



int D[200001];

vector<int> E[200001];

void dfs(int A, int B) {

	if (D[A] == 0) {

		D[A] = B;

		for (int i : E[A]) {

			dfs(i, B + 1);

		}

	}

}





int main() {

	cin.tie(0);

	ios::sync_with_stdio(false);





	int N;

	cin >> N;

	rep(i, N - 1) {

		int a, b;

		cin >> a >> b;

		E[a].pb(b);

		E[b].pb(a);

	}



	dfs(1, 1);



	int saidai = 0;

	int k;

	rep1(i, N) {

		if (saidai < D[i]) {

			saidai = D[i];

			k = i;

		}

	}

	rep1(i, N) D[i] = 0;



	dfs(k, 1);



	saidai = 0;

	rep1(i, N) {

		if (saidai < D[i]) {

			saidai = D[i];

		}

	}



	saidai++;



	if (saidai % 3 == 0) co("Second");

	else co("First");



	Would you please return 0;

}

// Faster C++ solution for the same problem (measured speedup: 3.582072526903292x):
#include<bits/stdc++.h>

using namespace std;

typedef long long ll;

#define rep(i, n) for(int i = 0; i < (n); i++)

#define rep1(i, n) for(int i = 1; i <= (n); i++)

#define co(x) cout << (x) << "\n"

#define cosp(x) cout << (x) << " "

#define ce(x) cerr << (x) << "\n"

#define cesp(x) cerr << (x) << " "

#define pb push_back

#define mp make_pair

#define Would

#define you

#define please



int D[200001];

pair<int, int> E[400001];

int H[200001];

void dfs(int A, int B) {

	if (D[A] == 0) {

		D[A] = B;

		for (int k = H[A]; k; k = E[k].second) {

			dfs(E[k].first, B + 1);

		}

	}

}





int main() {

	cin.tie(0);

	ios::sync_with_stdio(false);





	int N;

	cin >> N;

	int k = 1;

	rep(i, N - 1) {

		int a, b;

		cin >> a >> b;

		E[k] = mp(a, H[b]);

		H[b] = k;

		k++;

		E[k] = mp(b, H[a]);

		H[a] = k;

		k++;

	}



	dfs(1, 1);

	int saidai = 0;

	rep1(i, N) {

		if (saidai < D[i]) {

			saidai = D[i];

			k = i;

		}

	}



	memset(D, 0, sizeof(D));

	dfs(k, 1);

	saidai = 0;

	rep1(i, N) saidai = max(saidai, D[i]);

	saidai++;



	if (saidai % 3 == 0) co("Second");

	else co("First");



	cin >> N;



	Would you please return 0;

}
// Slower C++ solution:
#include<bits/stdc++.h>

using namespace std;

typedef long long ll;

#define rep(i, n) for(int i = 0; i < (n); i++)

#define rep1(i, n) for(int i = 1; i <= (n); i++)

#define co(x) cout << (x) << "\n"

#define cosp(x) cout << (x) << " "

#define ce(x) cerr << (x) << "\n"

#define cesp(x) cerr << (x) << " "

#define pb push_back

#define mp make_pair

#define Would

#define you

#define please



int D[200001];

vector<int> E[200001];

void dfs(int A, int B) {

	if (D[A] == 0) {

		D[A] = B;

		for (int i : E[A]) {

			dfs(i, B + 1);

		}

	}

}





int main() {

	cin.tie(0);

	ios::sync_with_stdio(false);





	int N;

	cin >> N;

	rep(i, N - 1) {

		int a, b;

		cin >> a >> b;

		E[a].pb(b);

		E[b].pb(a);

	}



	dfs(1, 1);



	int saidai = 0;

	int k;

	rep1(i, N) {

		if (saidai < D[i]) {

			saidai = D[i];

			k = i;

		}

	}

	rep1(i, N) D[i] = 0;



	dfs(k, 1);



	saidai = 0;

	rep1(i, N) {

		if (saidai < D[i]) {

			saidai = D[i];

		}

	}



	saidai++;



	if (saidai % 3 == 0) co("Second");

	else co("First");



	Would you please return 0;

}

// Faster C++ solution for the same problem (measured speedup: 6.4949934266032505x):
#include<bits/stdc++.h>

using namespace std;

typedef long long ll;

#define rep(i, n) for(int i = 0; i < (n); i++)

#define rep1(i, n) for(int i = 1; i <= (n); i++)

#define co(x) cout << (x) << "\n"

#define cosp(x) cout << (x) << " "

#define ce(x) cerr << (x) << "\n"

#define cesp(x) cerr << (x) << " "

#define pb push_back

#define mp make_pair

#define Would

#define you

#define please



bool D1[200001], D2[200001];

int K, saidai1, saidai2;

pair<int, int> E[400001];

int H[200001];

void dfs1(int A, int B) {

	if (*(D1 + A) == false) {

		*(D1 + A) = true;

		if (B > saidai1) {

			saidai1 = B;

			K = A;

		}

		for (int k = *(H + A); k; k = (*(E + k)).second) {

			dfs1((*(E + k)).first, B + 1);

		}

	}

}

void dfs2(int A, int B) {

	if (*(D2 + A) == false) {

		*(D2 + A) = true;

		saidai2 = max(saidai2, B);

		for (int k = *(H + A); k; k = (*(E + k)).second) {

			dfs2((*(E + k)).first, B + 1);

		}

	}

}



const int cm = 1 << 17;

char cn[cm], *ci = cn + cm, ct;

inline char getcha() {

	if (ci - cn == cm) { fread_unlocked(cn, 1, cm, stdin); ci = cn; }

	return *ci++;

}

inline int getint() {

	int A = 0;

	if (ci - cn + 16 > cm) while ((ct = getcha()) >= '0') A = A * 10 + ct - '0';

	else while ((ct = *ci++) >= '0') A = A * 10 + ct - '0';

	return A;

}



int main() {

	cin.tie(0);

	ios::sync_with_stdio(false);





	int N = getint();

	int k = 1;

	rep(i, N - 1) {

		int a = getint(), b = getint();

		*(E + k) = mp(a, *(H + b));

		*(H + b) = k++;

		*(E + k) = mp(b, *(H + a));

		*(H + a) = k++;

	}



	dfs1(1, 1);

	dfs2(K, 1);

	saidai2++;



	if (saidai2 % 3 == 0) co("Second");

	else co("First");



	Would you please return 0;

}
// Slower C++ solution:
#include<bits/stdc++.h>

using namespace std;

typedef long long ll;

#define rep(i, n) for(int i = 0; i < (n); i++)

#define rep1(i, n) for(int i = 1; i <= (n); i++)

#define co(x) cout << (x) << "\n"

#define cosp(x) cout << (x) << " "

#define ce(x) cerr << (x) << "\n"

#define cesp(x) cerr << (x) << " "

#define pb push_back

#define mp make_pair

#define Would

#define you

#define please



int D[200001];

pair<int, int> E[400001];

int H[200001];

void dfs(int A, int B) {

	if (D[A] == 0) {

		D[A] = B;

		for (int k = H[A]; k; k = E[k].second) {

			dfs(E[k].first, B + 1);

		}

	}

}





int main() {

	cin.tie(0);

	ios::sync_with_stdio(false);





	int N;

	cin >> N;

	int k = 1;

	rep(i, N - 1) {

		int a, b;

		cin >> a >> b;

		E[k] = mp(a, H[b]);

		H[b] = k;

		k++;

		E[k] = mp(b, H[a]);

		H[a] = k;

		k++;

	}



	dfs(1, 1);

	int saidai = 0;

	rep1(i, N) {

		if (saidai < D[i]) {

			saidai = D[i];

			k = i;

		}

	}



	memset(D, 0, sizeof(D));

	dfs(k, 1);

	saidai = 0;

	rep1(i, N) saidai = max(saidai, D[i]);

	saidai++;



	if (saidai % 3 == 0) co("Second");

	else co("First");



	cin >> N;



	Would you please return 0;

}

// Faster C++ solution for the same problem (measured speedup: 1.8131942828690253x):
#include<bits/stdc++.h>

using namespace std;

typedef long long ll;

#define rep(i, n) for(int i = 0; i < (n); i++)

#define rep1(i, n) for(int i = 1; i <= (n); i++)

#define co(x) cout << (x) << "\n"

#define cosp(x) cout << (x) << " "

#define ce(x) cerr << (x) << "\n"

#define cesp(x) cerr << (x) << " "

#define pb push_back

#define mp make_pair

#define Would

#define you

#define please



bool D1[200001], D2[200001];

int K, saidai1, saidai2;

pair<int, int> E[400001];

int H[200001];

void dfs1(int A, int B) {

	if (*(D1 + A) == false) {

		*(D1 + A) = true;

		if (B > saidai1) {

			saidai1 = B;

			K = A;

		}

		for (int k = *(H + A); k; k = (*(E + k)).second) {

			dfs1((*(E + k)).first, B + 1);

		}

	}

}

void dfs2(int A, int B) {

	if (*(D2 + A) == false) {

		*(D2 + A) = true;

		saidai2 = max(saidai2, B);

		for (int k = *(H + A); k; k = (*(E + k)).second) {

			dfs2((*(E + k)).first, B + 1);

		}

	}

}



const int cm = 1 << 17;

char cn[cm], *ci = cn + cm, ct;

inline char getcha() {

	if (ci - cn == cm) { fread_unlocked(cn, 1, cm, stdin); ci = cn; }

	return *ci++;

}

inline int getint() {

	int A = 0;

	if (ci - cn + 16 > cm) while ((ct = getcha()) >= '0') A = A * 10 + ct - '0';

	else while ((ct = *ci++) >= '0') A = A * 10 + ct - '0';

	return A;

}



int main() {

	cin.tie(0);

	ios::sync_with_stdio(false);





	int N = getint();

	int k = 1;

	rep(i, N - 1) {

		int a = getint(), b = getint();

		*(E + k) = mp(a, *(H + b));

		*(H + b) = k++;

		*(E + k) = mp(b, *(H + a));

		*(H + a) = k++;

	}



	dfs1(1, 1);

	dfs2(K, 1);

	saidai2++;



	if (saidai2 % 3 == 0) co("Second");

	else co("First");



	Would you please return 0;

}