#include <bits/stdc++.h>
using namespace std;
int read() {
  int s = 0, f = 1;
  char ch = getchar();
  while (ch < '0' || ch > '9') {
    if (ch == '-') f = -1;
    ch = getchar();
  }
  while (ch >= '0' && ch <= '9')
    s = (s << 3) + (s << 1) + ch - '0', ch = getchar();
  return f * s;
}
map<unsigned long long, int> mp;
unsigned long long val[400010];
int n, f[400010], up[400010], in[400010], cnt;
struct edge {
  int to, lt;
} e[400010 << 1];
void add(int x, int y) {
  e[++cnt].to = y;
  e[cnt].lt = in[x];
  in[x] = cnt;
  e[++cnt].to = x;
  e[cnt].lt = in[y];
  in[y] = cnt;
}
int gg;
int get(unsigned long long x) { return mp.count(x) ? mp[x] : mp[x] = ++gg; }
void dfs(int x, int fr) {
  unsigned long long s = 0;
  for (int i = in[x]; i; i = e[i].lt) {
    int y = e[i].to;
    if (y == fr) continue;
    dfs(y, x);
    s += val[f[y]];
  }
  f[x] = get(s);
}
int ans, mx, rt, num[400010];
void ins(int x) {
  if (!num[x]) ans++;
  num[x]++;
}
void del(int x) {
  num[x]--;
  if (!num[x]) ans--;
}
void dfs2(int x, int fr) {
  del(f[x]);
  if (ans >= mx) mx = ans, rt = x;
  unsigned long long s = val[up[fr]];
  for (int i = in[x]; i; i = e[i].lt) {
    int y = e[i].to;
    if (y == fr) continue;
    s += val[f[y]];
  }
  for (int i = in[x]; i; i = e[i].lt) {
    int y = e[i].to;
    if (y == fr) continue;
    unsigned long long nv = s - val[f[y]];
    up[x] = get(nv);
    ins(up[x]);
    dfs2(y, x);
    del(up[x]);
  }
  ins(f[x]);
}
int main() {
  n = read();
  srand(20021225);
  for (int i = 1; i <= 4 * n; i++)
    val[i] = (unsigned long long)rand() << 47 |
             (unsigned long long)rand() << 31 |
             (unsigned long long)rand() << 15 | rand();
  for (int i = 1; i < n; i++) add(read(), read());
  dfs(1, 0);
  for (int i = 1; i <= n; i++) ins(f[i]);
  dfs2(1, 0);
  printf("%d\n", rt);
  return 0;
}
