#include <bits/stdc++.h>
using namespace std;
const unsigned long long mod = 1e6 + 3;
const unsigned long long xr = 279787;
const int maxn = 1e5 + 10;
vector<int> g[maxn];
unsigned long long up[maxn], dw[maxn];
void dfs1(int u, int f) {
  dw[u] = 0;
  for (int i = 0; i < g[u].size(); i++) {
    int v = g[u][i];
    if (v == f) continue;
    dfs1(v, u);
    dw[u] += dw[v] * mod;
  }
  dw[u] ^= xr;
}
void dfs2(int u, int f) {
  unsigned long long tmp = ((dw[u] ^ xr) + up[u] * mod);
  for (int i = 0; i < g[u].size(); i++) {
    int v = g[u][i];
    if (v == f) continue;
    up[v] = (tmp - dw[v] * mod) ^ xr;
    dfs2(v, u);
  }
}
unsigned long long rt(int v) { return ((dw[v] ^ xr) + up[v] * mod) ^ xr; }
map<unsigned long long, int> mp;
int cur = 0;
void update(unsigned long long d, unsigned long long a) {
  --mp[d];
  if (mp[d] == 0) --cur;
  ++mp[a];
  if (mp[a] == 1) ++cur;
}
int ans, ansid;
void dfs3(int u, int f) {
  if (cur > ans) {
    ans = cur;
    ansid = u;
  }
  for (int i = 0; i < g[u].size(); i++) {
    int v = g[u][i];
    if (v == f) continue;
    update(dw[v], up[v]);
    update(rt(u), rt(v));
    dfs3(v, u);
    update(up[v], dw[v]);
    update(rt(v), rt(u));
  }
}
int main() {
  int n;
  scanf("%d", &n);
  for (int i = 0; i < n - 1; i++) {
    int u, v;
    scanf("%d%d", &u, &v);
    g[u].push_back(v);
    g[v].push_back(u);
  }
  dfs1(1, 0);
  dfs2(1, 0);
  ++mp[rt(1)];
  for (int i = 2; i <= n; i++) ++mp[dw[i]];
  cur = mp.size();
  ans = -1;
  dfs3(1, 0);
  printf("%d\n", ansid);
  return 0;
}
