#include <bits/stdc++.h>
using namespace std;
using LL = long long;
const int N = 1e5 + 10;
LL s[N * 2], hs[N], sh[N];
int f[N], g[N], h[N];
vector<int> adj[N];
unordered_map<LL, int> m;
void d1(int u, int fa = 0) {
  f[u] = fa;
  for (auto v : adj[u]) {
    if (v != fa) {
      d1(v, u);
      hs[u] += s[g[v]];
    }
  }
  if (m.count(hs[u]))
    g[u] = m[hs[u]];
  else {
    g[u] = m.size();
    m[hs[u]] = g[u];
  }
}
void d2(int u, int fa = 0) {
  if (fa) {
    sh[u] = hs[fa] - s[g[u]];
    if (fa != 1) sh[u] += s[h[fa]];
    if (m.count(sh[u]))
      h[u] = m[sh[u]];
    else {
      h[u] = m.size();
      m[sh[u]] = h[u];
    }
  }
  for (auto v : adj[u]) {
    if (v != fa) {
      d2(v, u);
    }
  }
}
unordered_map<LL, int> mp;
int cnt, ans, val;
inline void ADD(LL a) { cnt += (mp[a]++) == 0; }
inline void SUB(LL a) { cnt -= (mp[a]--) == 1; }
void d3(int u, int fa = 0) {
  if (cnt > val) {
    ans = u, val = cnt;
  }
  for (auto v : adj[u]) {
    if (v != fa) {
      SUB(hs[v]);
      ADD(sh[v]);
      d3(v, u);
      ADD(hs[v]);
      SUB(sh[v]);
    }
  }
}
int main() {
  srand(time(0));
  for (int i = 0; i < N * 2; i++) {
    s[i] = ((LL)rand() << 30) + ((LL)rand() << 20) + ((LL)rand() << 10) +
           rand() + 2513;
  }
  int n;
  scanf("%d", &n);
  for (int i = 2, u, v; i <= n; i++) {
    scanf("%d %d", &u, &v);
    adj[u].push_back(v);
    adj[v].push_back(u);
  }
  d1(1);
  d2(1);
  for (int i = 2; i <= n; i++) ADD(hs[i]);
  ans = 1, val = cnt;
  d3(1);
  cout << ans << endl;
  return 0;
}
