#include <bits/stdc++.h>
using namespace std;
const int maxn = 2e5 + 10;
int n, cnt, dif, Max, tot, ans;
int Head[maxn], Num[maxn], f[maxn];
unsigned long long pow1[maxn], pow2[maxn], val[maxn];
unordered_map<unsigned long long, int> mp;
struct node {
  int v, nxt;
} e[200005];
unsigned long long rnd() {
  return (unsigned long long)(rand() + 1) * 19260817 +
         (unsigned long long)(rand() + 1) * 2333 +
         ((unsigned long long)(rand() + 1231) << 58);
}
void addedge(int u, int v) {
  e[cnt].v = v;
  e[cnt].nxt = Head[u];
  Head[u] = cnt++;
}
void ins(int x) {
  if (!Num[x]) dif++;
  Num[x]++;
}
void del(int x) {
  Num[x]--;
  if (!Num[x]) dif--;
}
void dfs(int x, int fa) {
  unsigned long long sum = 0;
  for (int i = Head[x]; i + 1; i = e[i].nxt) {
    int y = e[i].v;
    if (y == fa) continue;
    dfs(y, x);
    sum += val[f[y]];
  }
  f[x] = mp.count(sum) ? mp[sum] : mp[sum] = ++tot;
  ins(f[x]);
}
void dfs2(int x, int fa, int c) {
  del(f[x]);
  if (dif + 1 > Max) {
    Max = dif;
    ans = x;
  }
  unsigned long long sum = 0;
  for (int i = Head[x]; i + 1; i = e[i].nxt)
    if (e[i].v != fa) sum += val[f[e[i].v]];
  sum += val[c];
  for (int i = Head[x]; i + 1; i = e[i].nxt) {
    int y = e[i].v;
    if (y == fa) continue;
    unsigned long long t = sum - val[f[y]];
    int tt = mp.count(t) ? mp[t] : mp[t] = ++tot;
    ins(tt);
    dfs2(y, x, tt);
    del(tt);
  }
  ins(f[x]);
}
int main() {
  scanf("%d", &n);
  srand((unsigned)time(NULL));
  for (int i = 1; i <= 2 * n; i++) val[i] = rnd();
  memset(Head, -1, sizeof(Head));
  for (int i = 1; i < n; i++) {
    int u, v;
    scanf("%d%d", &u, &v);
    addedge(u, v);
    addedge(v, u);
  }
  dfs(1, 0);
  dfs2(1, 0, 0);
  printf("%d\n", ans);
  return 0;
}
