stablegradients/pie-gem5-bysrc huggingface dataset:
// Original C++ solution (slower):
#include <iostream>

#include <cstdio>

#include <cstring>

using namespace std;



const int M = 1000000 + 5;

const int L = 14;



char H[M][L];



int getChar(char c){

  if(c == 'A')return 1;

  else if(c == 'C')return 2;

  else if(c == 'G')return 3;

  else if(c == 'T')return 4;

  else return 0;

}



long long getKey(char str[]){

  int len = strlen(str);

  long long sum = 0,p = 1;

  for(int i = 0;i < len; i++){

    sum += p*getChar(str[i]);

    p *= 5;

  }

  return sum;

}



int h1(int key){

  return key % M;

}



int h2(int key){

  return 1 + (key % (M - 1));

}



void insert(char str[]){

  long long key = getKey(str);

  for(int i = 0;; i++){

    int h = (h1(key) + i*h2(key))%M;

    if(strcmp(H[h],str) == 0)return;

    if(strlen(H[h]) == 0){

      strcpy(H[h],str);

      return ;

    }

  }

  return;

}



bool find (char str[]){

  long long key = getKey(str);

  for(int i = 0;; i++){

    int h = (h1(key) + i*h2(key))%M;

    if(strcmp(H[h],str) == 0)return true;

    else if(strlen(H[h]) == 0)return false;

  }

  return false;

}



int main(){

  int n;

  scanf("%d",&n);

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

    char s1[8],s2[14];

    scanf("%s%s",s1,s2);

    if(s1[0] == 'i'){

      insert(s2);

    }

    else{

      if(find(s2)){

        printf("yes\n");

      }

      else {

        printf("no\n");

      }

    }

  }

}

// Optimized solution to the same problem (faster):
/*

//alds1_4_c:Dictionary

//算法:开放地址法散列表

//Time: 2018/1/8 星期一

*/

#include<stdio.h>

#include<string.h>



const int M=1000003;

const int L=14;



char H[M][L];



//对于每个字符返回的定义值

int getChar(char ch){

    if(ch=='A') return 1;

    if(ch=='C') return 2;

    if(ch=='D') return 3;

    if(ch=='T') return 4;

    return 0;

}

//对于字符串返回的初始散列值

long long getKey(char str[]){

    long long len=strlen(str),sum=0,p=1;

    for(int i=0;i<len;++i){

        sum+=p*getChar(str[i]);

        //每次获取定义值后p*5,相当于转换成五进制,不会冲突

        p*=5;

    }

    return sum;

}



//开放式散列值计算式: h(k,i)=(h1(k)+i*h2(k))%M

int h1(int key){

    return key%M;

}

//为了保证不会递归冲突(即往下算结果始终相同),必须使h2(key)与M互素

//TLE最好的情况就是改这个函数= =

//目前可以AC的: 1+(key%(M-1))

//(1+key)%(M-1)

int h2(int key){

    return (1+key)%(M-1);

}



//查找

//-1表示找到

//h表示找到第一个可插入点

int find(char str[]){

    long long key=getKey(str),i,h;

    for(i=0;;++i){

        h=(h1(key)+i*h2(key))%M;

        if(strcmp(H[h],str)==0) return -1;

        else if(strlen(H[h])==0) return h;

    }

    return 0;

}



//插入

void insert(char str[]){

    int key=find(str);

    if(key!=-1) strcpy(H[key],str);

}



int main(){

    for(int i=0;i<M;++i) H[M][0]='\0';

    char str[L],com[L];

    int n;

    scanf("%d",&n);

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

        scanf("%s %s",com,str);



        if(com[0]=='i'){

            insert(str);

        }else{

            if(find(str)==-1)

                printf("yes\n");

            else

                printf("no\n");

        }

    }



    return 0;

}




// Fastest known solution for this problem:
// Original C++ solution (slower):
#include<cstdio>

#include<cstdlib>

#include<cmath>

#include<cstring>

#include<iostream>

#include<algorithm>

#include<queue>

#include<map>

#include<vector>

#include<stack>

#include<list>



typedef long long ll;



using namespace std;



char H[1046527][15];



int getCharKey(char a){

	if(a == 'A')

		return 1;

	else if(a == 'C'){

		return 2;

	}

	else if(a == 'G'){

		return 3;

	}

	else if(a == 'T'){

		return 4;

	}

	else

		return 0;

}



ll getKey(char a[]){

	ll sum = 0;

	ll p = 1;

	for(ll i = 0 ; i<strlen(a) ; i++){

		sum += p*getCharKey(a[i]);

		p *=5;

	}

	return sum;

}



int h1(int key){

	return key%1046527;

}

int h2(int key){

	return 1+ (key%1046526);

}



int insert(char a[]){

	ll key = getKey(a);

	for(ll i = 0 ; ; i++){

		ll h = (h1(key) + i*h2(key)) %1046527;

		if(strcmp(H[h] , a) == 0)

			return 1;

		else if(strlen(H[h]) == 0){

			strcpy(H[h] , a);

			return 0;

		}

	}

	return 0;

}



int find(char a[]){

	ll key = getKey(a);

	for(ll i = 0 ; ; i++){

		ll h = (h1(key) + i*h2(key)) %1046527;

		if(strcmp(H[h] , a) == 0)

			return 1;

		else if(strlen(H[h]) == 0)

			return 0;

	}

	return 0; 

}

int main(){

	ios::sync_with_stdio(false);

	int n;

	cin>>n;

	for(int i = 0 ; i<n ; i++)

		H[i][0] = '\0';

	

	char a[20] , b[20];

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

		cin>>a>>b;

		if(a[0] == 'i')

			insert(b);

		else{

			if(find(b))

				cout<<"yes"<<endl;

			else

				cout<<"no"<<endl;

		}

	}

	return 0;

}

// Optimized solution to the same problem (faster):
/*

//alds1_4_c:Dictionary

//算法:开放地址法散列表

//Time: 2018/1/8 星期一

*/

#include<stdio.h>

#include<string.h>



const int M=1000003;

const int L=14;



char H[M][L];



//对于每个字符返回的定义值

int getChar(char ch){

    if(ch=='A') return 1;

    if(ch=='C') return 2;

    if(ch=='D') return 3;

    if(ch=='T') return 4;

    return 0;

}

//对于字符串返回的初始散列值

long long getKey(char str[]){

    long long len=strlen(str),sum=0,p=1;

    for(int i=0;i<len;++i){

        sum+=p*getChar(str[i]);

        //每次获取定义值后p*5,相当于转换成五进制,不会冲突

        p*=5;

    }

    return sum;

}



//开放式散列值计算式: h(k,i)=(h1(k)+i*h2(k))%M

int h1(int key){

    return key%M;

}

//为了保证不会递归冲突(即往下算结果始终相同),必须使h2(key)与M互素

//TLE最好的情况就是改这个函数= =

//目前可以AC的: 1+(key%(M-1))

//(1+key)%(M-1)

int h2(int key){

    return (1+key)%(M-1);

}



//查找

//-1表示找到

//h表示找到第一个可插入点

int find(char str[]){

    long long key=getKey(str),i,h;

    for(i=0;;++i){

        h=(h1(key)+i*h2(key))%M;

        if(strcmp(H[h],str)==0) return -1;

        else if(strlen(H[h])==0) return h;

    }

    return 0;

}



//插入

void insert(char str[]){

    int key=find(str);

    if(key!=-1) strcpy(H[key],str);

}



int main(){

    for(int i=0;i<M;++i) H[M][0]='\0';

    char str[L],com[L];

    int n;

    scanf("%d",&n);

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

        scanf("%s %s",com,str);



        if(com[0]=='i'){

            insert(str);

        }else{

            if(find(str)==-1)

                printf("yes\n");

            else

                printf("no\n");

        }

    }



    return 0;

}




// Fastest known solution for this problem:
// Original C++ solution (slower):
#include <iostream>

#include <map>

using namespace std;



int main(){

	int n;cin >> n;

	string s, str;

	map<string, int> m;

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

		cin >> s >> str;

		if(s[0] == 'i'){

			m[str] = 1;

		}else{

			if(m[str])cout << "yes" << endl;

			else cout << "no" << endl;

		}

	}

	return 0;

}

// Optimized solution to the same problem (faster):
#include <cstdio>

using namespace std;

bool d[33554432];

char k[128];



int c(char str[12]){

	int ans = str[0], i = 1;

	for(i;str[i] != '\0';i++){ans <<= 2;ans += k[str[i]];}

	return ans;

}



int main(){

	k['A'] = 0;k['C'] = 1;k['G'] = 2;k['T'] = 3;

	int n;scanf("%d", &n);

	char s[7], str[12];

	while(n--){

		scanf("%s %s", s, str);

		if(s[0] == 'i')d[c(str)] = true;

		else puts(d[c(str)] ? "yes" : "no");

	}

	return 0;

}

// Fastest known solution for this problem:
// Original C++ solution (slower):
#include <iostream>

#include <map>

#include <cstdio>

using namespace std;



int main(){

	int n;scanf("%d", &n);

	char s[7], str[13];

	map<string, int> m;

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

		scanf("%s %s", s, str);

		if(s[0] == 'i')m[str] = 1;

		else puts(m[str] ? "yes" : "no");

	}

	return 0;

}

//1.78

// Optimized solution to the same problem (faster):
#include <cstdio>

using namespace std;

bool d[33554432];

char k[128];



int c(char str[12]){

	int ans = str[0], i = 1;

	for(i;str[i] != '\0';i++){ans <<= 2;ans += k[str[i]];}

	return ans;

}



int main(){

	k['A'] = 0;k['C'] = 1;k['G'] = 2;k['T'] = 3;

	int n;scanf("%d", &n);

	char s[7], str[12];

	while(n--){

		scanf("%s %s", s, str);

		if(s[0] == 'i')d[c(str)] = true;

		else puts(d[c(str)] ? "yes" : "no");

	}

	return 0;

}

// Fastest known solution for this problem:
// Original C++ solution (slower):
#include <iostream>

#include <map>

#include <cstdio>

using namespace std;



int main(){

	int n;scanf("%d", &n);

	char s[7], str[13];

	map<string, bool> m;

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

		scanf("%s %s", s, str);

		if(s[0] == 'i')m[str] = true;

		else puts(m[str] ? "yes" : "no");

	}

	return 0;

}

//1.78

//0.87

// Optimized solution to the same problem (faster):
#include <cstdio>

using namespace std;

bool d[33554432];

char k[128];



int c(char str[12]){

	int ans = str[0], i = 1;

	for(i;str[i] != '\0';i++){ans <<= 2;ans += k[str[i]];}

	return ans;

}



int main(){

	k['A'] = 0;k['C'] = 1;k['G'] = 2;k['T'] = 3;

	int n;scanf("%d", &n);

	char s[7], str[12];

	while(n--){

		scanf("%s %s", s, str);

		if(s[0] == 'i')d[c(str)] = true;

		else puts(d[c(str)] ? "yes" : "no");

	}

	return 0;

}

// Fastest known solution for this problem:
// Original C++ solution (slower):
#include <cstdio>

#include <cstring>

#include <map>

using namespace std;

bool d[33554432];

map<char, int> k;



int c(char str[12]){

	int ans = str[0];

	for(int i = 1;i < strlen(str);i++){

		ans <<= 2;

		ans += k[str[i]];

	}

	return ans;

}



int main(){

	k['A'] = 0;k['C'] = 1;k['G'] = 2;k['T'] = 3;

	int n;scanf("%d", &n);

	char s[7], str[12];

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

		scanf("%s %s", s, str);

		if(s[0] == 'i')d[c(str)] = true;

		else puts(d[c(str)] ? "yes" : "no");

	}

	return 0;

}

// Optimized solution to the same problem (faster):
#include <cstdio>

using namespace std;

bool d[33554432];

char k[128];



int c(char str[12]){

	int ans = str[0], i = 1;

	for(i;str[i] != '\0';i++){ans <<= 2;ans += k[str[i]];}

	return ans;

}



int main(){

	k['A'] = 0;k['C'] = 1;k['G'] = 2;k['T'] = 3;

	int n;scanf("%d", &n);

	char s[7], str[12];

	while(n--){

		scanf("%s %s", s, str);

		if(s[0] == 'i')d[c(str)] = true;

		else puts(d[c(str)] ? "yes" : "no");

	}

	return 0;

}

// Fastest known solution for this problem:
// Original C++ solution (slower):
#include <iostream>

#include <set>

#include <string>

using namespace std;



int main() {

	ios::sync_with_stdio(false);

        cin.tie(0);

	int n;

	cin >> n;

	set<string> st;

	while(n--){

		string order;

		string str;

		

		cin>>order;

		cin>>str;

		

		if(order=="insert"){

			st.insert(str);

		}else{

			if(st.find(str)!=st.end()){

				cout<<"yes"<<endl;

			}else{

				cout<<"no"<<endl;

			}

		}

	}

	return 0;

}

// Optimized solution to the same problem (faster):
#include<cstdio>

#include<cstring>

using namespace std;

#define M 1000000//??????????????°

#define L 12	  //??????????????????



char H[M][L];



//??????????????°???

int getChar(char ch){

	if(ch=='A') return 1;

	else if(ch=='C') return 2;

	else if(ch=='G') return 3;

	else if(ch=='T') return 4;

	else return 0;

}



int getKey(char str[]){

	int sum = 0, p=1, i;

	for(i=0;i<strlen(str);i++){

		sum += p*( getChar(str[i]) );

		p *= 5;

	}

	return sum;

}



int h1(int key){ return key % M; }

int h2(int key){ return 1 + (key % (M-1)); }

int hashfunc(int key,int i){ return ( h1(key) + i*h2(key) ) % M; }



int find(char str[]){

	int key,i,h;

	key = getKey(str);

	for( i=0 ; ; i++ ){

		h = hashfunc(key,i);

		if(strcmp(H[h],str) == 0) return 1;

		else if( strlen(H[h]) == 0 ) return 0;//??°?????£???????????¨???????????¨?????\??£???????????¨???????????¨???

	}

	return 0;

} 



void insert(char str[]){

	int key,i,h;

	key = getKey(str);

	for( i=0 ; ; i++ ){

		h = hashfunc(key,i);

		if(strcmp(H[h],str) == 0) return;

		else if(strlen(H[h]) == 0){

			strcpy(H[h],str);

			return;

		}

	}

	return;

}



int main(){

	int i,n,h;

	scanf("%d",&n);

	for(i = 0;i<n;i++){

		char command[6];

		char str[12];

		scanf("%s%s",command,str);

		if(command[0] == 'i'){

			insert(str);

		}else{

			if(find(str)){

				printf("yes\n");

			}else{

				printf("no\n");

			}

		}

	}

	return 0;

}

// Fastest known solution for this problem:
// Original C++ solution (slower):
#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;

}


// Optimized solution to the same problem (faster):
#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; 

}

// Fastest known solution for this problem:
// Original C++ solution (slower):
#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");

}

// Optimized solution to the same problem (faster):
#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;

}

// Fastest known solution for this problem:
// Original C++ solution (slower):
//#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;      

}

                          

// Optimized solution to the same problem (faster):
#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;

}

// Fastest known solution for this problem:
// Original C++ solution (slower):
//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";

}

// Optimized solution to the same problem (faster):
#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;

}

// Fastest known solution for this problem:
// Original C++ solution (slower):
#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;

}


// Optimized solution to the same problem (faster):
#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;

}

// Fastest known solution for this problem: