#include <bits/stdc++.h>
using namespace std;
map<vector<int>, int> f;
vector<int> v[100010];
int sz[100010], tp[100010], cnt, gas[100010];
int n, a, b, cur, ans, val, mx;
void dfs_size(int x, int pre) {
  sz[x] = 1;
  for (auto y : v[x])
    if (pre != y) {
      dfs_size(y, x);
      sz[x] += sz[y];
    }
}
void find_cur() {
  bool fg = true;
  while (fg) {
    fg = false;
    for (auto y : v[cur])
      if (sz[y] < sz[cur]) {
        if (sz[y] * 2 >= n) {
          cur = y;
          fg = true;
          break;
        }
      }
  }
}
void dfs_type(int x, int pre) {
  vector<int> tmp;
  for (auto y : v[x])
    if (pre != y) {
      dfs_type(y, x);
      tmp.push_back(tp[y]);
    }
  sort(tmp.begin(), tmp.end());
  int tt = f[tmp];
  if (tt)
    tp[x] = tt;
  else
    f[tmp] = tp[x] = ++cnt;
}
void dfs_find(int x, int pre, int val) {
  if (gas[tp[x]] > 1) val++;
  if (val > mx) {
    ans = x, mx = val;
  }
  for (auto y : v[x])
    if (y != pre) {
      dfs_find(y, x, val);
    }
}
int main() {
  scanf("%d", &n);
  for (int i = 1; i < n; i++) {
    scanf("%d %d", &a, &b);
    a--, b--;
    v[a].push_back(b);
    v[b].push_back(a);
  }
  dfs_size(0, -1);
  find_cur();
  dfs_type(cur, -1);
  for (int i = 0; i < n; i++) gas[tp[i]]++;
  dfs_find(cur, -1, 0);
  printf("%d\n", ans + 1);
}
