#include <bits/stdc++.h>
using namespace std;
const int N = 2e5 + 10;
int n, tot, ans, mx, cnt, dif;
int head[N], num[N];
unsigned long long val[N], f[N];
map<unsigned long long, int> mp;
int read() {
  int ret = 0;
  char c = getchar();
  while (!isdigit(c)) c = getchar();
  while (isdigit(c)) ret = ret * 10 + (c ^ 48), c = getchar();
  return ret;
}
struct Tway {
  int v, nex;
} e[N];
void add(int u, int v) {
  e[++tot] = (Tway){v, head[u]};
  head[u] = tot;
  e[++tot] = (Tway){u, head[v]};
  head[v] = tot;
}
void ins(int x) {
  if (!num[x]) ++dif;
  ++num[x];
}
void del(int x) {
  --num[x];
  if (!num[x]) --dif;
}
int get(int x) { return mp.count(x) ? mp[x] : mp[x] = ++cnt; }
void dfs1(int x, int fa) {
  unsigned long long sum = 0;
  for (int i = head[x]; i; i = e[i].nex)
    if (e[i].v ^ fa) dfs1(e[i].v, x), sum += val[f[e[i].v]];
  f[x] = get(sum);
  ins(f[x]);
}
void dfs2(int x, int fa, int c) {
  del(f[x]);
  if (dif + 1 > mx)
    mx = dif + 1, ans = x;
  else if (dif + 1 == mx && x < ans)
    ans = x;
  unsigned long long sum = 0;
  for (int i = head[x]; i; i = e[i].nex)
    if (e[i].v ^ fa) sum += val[f[e[i].v]];
  sum += val[c];
  for (int i = head[x]; i; i = e[i].nex) {
    int v = e[i].v;
    if (v == fa) continue;
    unsigned long long snow = sum - val[f[v]];
    ins(get(snow));
    dfs2(v, x, get(snow));
    del(get(snow));
  }
  ins(f[x]);
}
unsigned long long rnd() {
  return (unsigned long long)(rand() + 1) * 2333 +
         (unsigned long long)(rand() + 1) * 19260817 +
         (unsigned long long)((rand() + 1231) << 28);
}
int main() {
  n = read();
  for (int i = 1; i <= n * 2; ++i) val[i] = rnd();
  for (int i = 1; i < n; ++i) add(read(), read());
  dfs1(1, 0);
  dfs2(1, 0, 0);
  printf("%d\n", ans);
  return 0;
}
