#include <bits/stdc++.h>
using namespace std;
const int maxn = 100005;
int n, sz[maxn], G, Gs;
int C[maxn << 1], Pre;
unsigned long long H[maxn << 1];
int ecnt, pt[maxn << 1], nt[maxn << 1], hd[maxn];
unsigned long long wt[maxn << 1];
void ins(int u, int v) {
  pt[++ecnt] = v;
  nt[ecnt] = hd[u];
  hd[u] = ecnt;
}
void Max(int &x, int y) {
  if (x < y) x = y;
}
void Dfs(int x, int f) {
  int i, mx = 0;
  sz[x] = 1;
  for (i = hd[x]; i; i = nt[i])
    if (pt[i] != f) {
      Dfs(pt[i], x);
      Max(mx, sz[pt[i]]);
      sz[x] += sz[pt[i]];
    }
  Max(mx, n - sz[x]);
  if (!G || mx < Gs) Gs = mx, G = x;
}
unsigned long long Sol(int x, int f) {
  int i, tot;
  vector<unsigned long long> hs;
  for (i = hd[x]; i; i = nt[i])
    if (pt[i] != f) {
      if (!wt[i]) wt[i] = Sol(pt[i], x);
      hs.push_back(wt[i]);
    }
  tot = hs.size();
  sort(hs.begin(), hs.end());
  unsigned long long tmp = 20170217;
  for (i = 0; i < tot; i++) tmp = (tmp * 55555 + hs[i]) ^ 233333333;
  return tmp;
}
void dfs0(int x, int f) {
  int i;
  for (i = hd[x]; i; i = nt[i])
    if (pt[i] != f) {
      if ((C[wt[i]]++) == 0) Pre++;
      dfs0(pt[i], x);
    }
}
int Ans, Rt;
void dfs1(int x, int f) {
  int i;
  if (Pre > Ans) Ans = Pre, Rt = x;
  for (i = hd[x]; i; i = nt[i])
    if (pt[i] != f) {
      ++Pre;
      if ((--C[wt[i]]) == 0) Pre--;
      dfs1(pt[i], x);
      --Pre;
      if ((C[wt[i]]++) == 0) Pre++;
    }
}
int main() {
  int i, u, v, tot = 0;
  scanf("%d", &n);
  for (ecnt = i = 1; i < n; i++) {
    scanf("%d%d", &u, &v);
    ins(u, v);
    ins(v, u);
  }
  Dfs(1, 0);
  Sol(G, 0);
  for (i = 1; i <= ecnt; ++i)
    if (wt[i]) H[++tot] = wt[i];
  sort(H + 1, H + tot + 1);
  tot = unique(H + 1, H + ecnt + 1) - H - 1;
  for (i = 1; i <= ecnt; i++)
    if (wt[i]) wt[i] = lower_bound(H + 1, H + tot + 1, wt[i]) - H;
  dfs0(G, 0);
  Ans = -1;
  dfs1(G, 0);
  printf("%d\n", Rt);
  return 0;
}
