#include <bits/stdc++.h>
using namespace std;
const int maxn = 100011;
const long long Hashstart = 0x129847DABCEF194LL, Index = 7,
                Hashxor = 218979012481290125LL;
int now[maxn], pre[maxn << 1], son[maxn << 1], tot = 0;
void add(int a, int b) {
  pre[++tot] = now[a];
  now[a] = tot;
  son[tot] = b;
}
void cc(int a, int b) {
  add(a, b);
  add(b, a);
}
int n;
void init() {
  scanf("%d", &n);
  for (int i = 1, a, b; i < n; ++i) scanf("%d%d", &a, &b), cc(a, b);
}
long long Down[maxn], Up[maxn];
void dfs1(int x, int fa) {
  long long tmp = Hashstart;
  for (int p = now[x]; p; p = pre[p])
    if (son[p] != fa) {
      dfs1(son[p], x);
      tmp += Down[son[p]] * Index;
    }
  Down[x] = tmp ^ Hashxor;
}
void dfs2(int x, int fa) {
  long long tmp = Down[x];
  if (x != 1) {
    tmp ^= Hashxor;
    tmp += Up[x] * Index;
    tmp ^= Hashxor;
  }
  for (int p = now[x]; p; p = pre[p])
    if (son[p] != fa)
      Up[son[p]] = ((tmp ^ Hashxor) - Down[son[p]] * Index) ^ Hashxor;
  for (int p = now[x]; p; p = pre[p])
    if (son[p] != fa) dfs2(son[p], x);
}
map<long long, int> S;
int ans1, ans2, sum;
void dfs3(int x, int fa) {
  if (sum > ans2) ans1 = x, ans2 = sum;
  for (int p = now[x]; p; p = pre[p])
    if (son[p] != fa) {
      if (--S[Down[son[p]]] == 0) --sum;
      if (++S[Up[son[p]]] == 1) ++sum;
      dfs3(son[p], x);
      if (++S[Down[son[p]]] == 1) ++sum;
      if (--S[Up[son[p]]] == 0) --sum;
    }
}
void work() {
  dfs1(1, 0);
  Up[1] = 1;
  dfs2(1, 0);
  S.clear();
  for (int i = 2; i <= n; ++i) ++S[Down[i]];
  ans1 = 1;
  sum = ans2 = S.size();
  dfs3(1, 0);
  printf("%d\n", ans1);
}
int main() {
  init();
  work();
  return 0;
}
