#include <bits/stdc++.h>
using namespace std;
const unsigned long long mod = 1e9 + 7;
const unsigned long long Maxn = 1e5 + 5;
inline unsigned long long R() {
  char c;
  unsigned long long res, sign = 1;
  while ((c = getchar()) > '9' || c < '0')
    if (c == '-') sign = -1;
  res = c - '0';
  while ((c = getchar()) >= '0' && c <= '9') res = res * 10 + c - '0';
  return res * sign;
}
unsigned long long n, m, head[Maxn], to[Maxn * 2], Next[Maxn * 2],
    cnt = 1, dp[Maxn * 2], siz[Maxn * 2], now, ans1, ans2;
inline void add(unsigned long long z, unsigned long long y) {
  Next[++cnt] = head[z];
  head[z] = cnt;
  to[cnt] = y;
}
map<unsigned long long, unsigned long long> mp;
void insert(unsigned long long x) {
  if (mp[x]++ == 0) ++now;
}
void erase(unsigned long long x) {
  if (--mp[x] == 0) --now;
}
void dfs1(unsigned long long k, unsigned long long f, unsigned long long e) {
  siz[e] = 1;
  for (unsigned long long i = head[k]; i; i = Next[i]) {
    unsigned long long v = to[i];
    if (v != f)
      dfs1(v, k, i), (siz[e] += siz[i]) %= mod, (dp[e] += dp[i]) %= mod;
  }
  dp[e] = (siz[e] * dp[e] % mod + siz[e] * siz[e] % mod) % mod, insert(dp[e]);
}
void dfs2(unsigned long long pos, unsigned long long father) {
  unsigned long long Sum = 0;
  for (unsigned long long k = head[pos]; k; k = Next[k])
    Sum = (Sum + dp[k]) % mod;
  for (unsigned long long k = head[pos]; k; k = Next[k]) {
    siz[k ^ 1] = n - siz[k];
    dp[k ^ 1] =
        (n - siz[k]) * (Sum - dp[k] + mod) % mod + (n - siz[k]) * (n - siz[k]);
    dp[k ^ 1] %= mod;
    if (to[k] == father) continue;
    dfs2(to[k], pos);
  }
}
void dfs3(unsigned long long pos, unsigned long long father,
          unsigned long long fr) {
  for (unsigned long long k = head[pos]; k; k = Next[k]) {
    if (to[k] == father) continue;
    erase(dp[k]);
    insert(dp[k ^ 1]);
    if (now > ans1) {
      ans1 = now;
      ans2 = to[k];
    }
    dfs3(to[k], pos, k);
    erase(dp[k ^ 1]);
    insert(dp[k]);
  }
}
signed main() {
  n = R();
  unsigned long long x, y;
  for (unsigned long long i = 1; i < n; i++) {
    x = R();
    y = R();
    add(x, y);
    add(y, x);
  }
  dfs1(1, 0, 0);
  ans1 = now;
  ans2 = 1;
  dfs2(1, 0);
  dfs3(1, 0, 0);
  cout << ans2;
}
