#include <bits/stdc++.h>
using namespace std;
unsigned long long hsh[100005 << 1], typ[100005], typ2[100005];
vector<int> lin[100005];
map<unsigned long long, int> cnt, subt;
int hd[100005], hd2[100005], num, ansv, now, n, v, u;
void init(int n) {
  for (int i = 0; i < 2 * (n + 1); i++)
    hsh[i] = ((unsigned long long)rand() << 40) +
             ((unsigned long long)rand() << 20) + ((unsigned long long)rand());
}
void dfs1(int u, int fa) {
  typ[u] = hsh[0];
  for (int i = 0; i < lin[u].size(); i++) {
    if (lin[u][i] == fa) continue;
    dfs1(lin[u][i], u);
    typ[u] += hsh[hd[lin[u][i]]];
  }
  if (!subt.count(typ[u])) subt[typ[u]] = ++num;
  hd[u] = subt[typ[u]];
}
void dfs2(int u, int fa) {
  unsigned long long h = typ[u];
  if (fa != 0) h += hsh[hd2[u]];
  for (int i = 0; i < lin[u].size(); i++) {
    if (lin[u][i] == fa) continue;
    typ2[lin[u][i]] = h - hsh[hd[lin[u][i]]];
    if (!subt.count(typ2[lin[u][i]])) subt[typ2[lin[u][i]]] = ++num;
    hd2[lin[u][i]] = subt[typ2[lin[u][i]]];
  }
  for (int i = 0; i < lin[u].size(); i++) {
    if (lin[u][i] == fa) continue;
    dfs2(lin[u][i], u);
  }
}
void dfs3(int u, int fa) {
  if (cnt.size() > ansv) {
    ansv = cnt.size();
    now = u;
  }
  for (int i = 0; i < lin[u].size(); i++) {
    int v = lin[u][i];
    if (v == fa) continue;
    cnt[typ[v]]--;
    if (cnt[typ[v]] == 0) cnt.erase(typ[v]);
    cnt[typ2[v]]++;
    dfs3(v, u);
    cnt[typ2[v]]--;
    if (cnt[typ2[v]] == 0) cnt.erase(typ2[v]);
    cnt[typ[v]]++;
  }
}
int main() {
  scanf("%d", &n);
  init(n);
  for (int i = 1; i < n; i++) {
    scanf("%d%d", &u, &v);
    lin[u].push_back(v);
    lin[v].push_back(u);
  }
  dfs1(1, 0);
  dfs2(1, 0);
  for (int i = 2; i <= n; i++) cnt[typ[i]]++;
  now = 1, ansv = cnt.size();
  dfs3(1, 0);
  printf("%d\n", now);
  return 0;
}
