#include <bits/stdc++.h>
using namespace std;
const int N = 100005;
int ct = 0, n;
vector<int> G[N];
int fa[N];
int a[N];
map<int, int> son[N], sump;
map<map<int, int>, int> mp;
void input() {
  cin >> n;
  for (int i = 0; i < n - 1; i++) {
    int x, y;
    scanf("%d %d", &x, &y);
    G[x].push_back(y);
    G[y].push_back(x);
  }
}
int dfs1(int u) {
  map<int, int> st;
  for (int i = 0; i < G[u].size(); i++) {
    int v = G[u][i];
    if (v != fa[u]) {
      fa[v] = u;
      st[dfs1(v)]++;
    }
  }
  if (!mp.count(st)) mp[st] = ++ct;
  son[u] = st;
  sump[mp[st]]++;
  return a[u] = mp[st];
}
int mx, ans;
void dfs2(int u) {
  map<int, int> st;
  if (fa[u]) {
    st = son[fa[u]];
    st[a[u]]--;
    if (st[a[u]] == 0) st.erase(a[u]);
    if (!mp.count(st)) mp[st] = ++ct;
    sump[mp[st]]++;
    sump[a[u]]--;
    if (sump[a[u]] == 0) sump.erase(a[u]);
    if ((int)sump.size() > mx) mx = sump.size(), ans = u;
    son[u][mp[st]]++;
  }
  for (int i = 0; i < G[u].size(); i++) {
    int v = G[u][i];
    if (v != fa[u]) dfs2(v);
  }
  if (fa[u]) {
    sump[mp[st]]--;
    if (sump[mp[st]] == 0) sump.erase(mp[st]);
    sump[a[u]]++;
  }
}
int main() {
  input();
  dfs1(1);
  mx = sump.size(), ans = 1;
  dfs2(1);
  cout << ans << endl;
  return 0;
}
