#include <bits/stdc++.h>
using namespace std;
long long has(long long a) { return a * a * 231237 + a * 1023119 + 3213117; }
int n;
vector<int> eg[1000005];
long long dp[1000005];
long long fr[1000005];
int dfn[1000005], sz[1000005];
int dfcnt = 0;
const long long dd = 307;
void dfs1(int a, int fa) {
  dfn[a] = ++dfcnt;
  sz[a] = 1;
  for (auto v : eg[a]) {
    if (v == fa) continue;
    dfs1(v, a);
    sz[a] += sz[v];
    dp[a] += has(dp[v]);
  }
  dp[a] += dd;
}
void dfs2(int a, int fa) {
  if (fa) {
    fr[a] = dp[fa] - has(dp[a]);
    if (fa != 1) fr[a] += has(fr[fa]);
  }
  for (auto v : eg[a]) {
    if (v == fa) continue;
    dfs2(v, a);
  }
}
int d[1000005];
void act(int l, int r) {
  if (l > r) return;
  d[l]++, d[r + 1]--;
}
void upd(vector<pair<int, int> > cur) {
  sort(cur.begin(), cur.end());
  int mx = 0;
  for (int i = 0; i < cur.size(); i++) {
    if (cur[i].first > cur[i].second) continue;
    act(max(mx + 1, cur[i].first), cur[i].second), mx = max(mx, cur[i].second);
  }
}
vector<pair<long long, int> > chk;
int main() {
  int n;
  cin >> n;
  for (int i = 1; i < n; i++) {
    int u, v;
    scanf("%d%d", &u, &v);
    eg[u].push_back(v), eg[v].push_back(u);
  }
  dfs1(1, 0);
  dfs2(1, 0);
  for (int i = 1; i <= n; i++) chk.push_back(make_pair(dp[i], i));
  for (int i = 2; i <= n; i++) chk.push_back(make_pair(fr[i], -i));
  sort(chk.begin(), chk.end());
  for (int i = 0; i < chk.size();) {
    int j = i;
    while (j < chk.size() && chk[j].first == chk[i].first) j++;
    vector<pair<int, int> > cur;
    for (int k = i; k < j; k++) {
      int id = chk[k].second;
      if (id > 0)
        cur.push_back(make_pair(1, dfn[id] - 1)),
            cur.push_back(make_pair(dfn[id] + sz[id], n));
      else
        id = -id, cur.push_back(make_pair(dfn[id], dfn[id] + sz[id] - 1));
    }
    upd(cur);
    i = j;
  }
  for (int i = 1; i <= n; i++) d[i] += d[i - 1];
  int ea = -1, epl = 0;
  for (int i = 1; i <= n; i++) {
    int na = d[dfn[i]];
    if (na > ea) ea = na, epl = i;
  }
  cout << epl << endl;
  return 0;
}
