#include <bits/stdc++.h>
using namespace std;
long long n, head[200000], nxt[300000], to[300000], cnt = 1, ans;
void add(long long a, long long b) {
  nxt[++cnt] = head[a];
  to[cnt] = b;
  head[a] = cnt;
}
unordered_map<long long, long long> mp;
long long insert(long long v) { return ans = ans + ((mp[v]++) == 0); }
long long remove(long long v) { return ans = ans - ((--mp[v]) == 0); }
long long siz[300000], dp[300000];
long long mx, pos;
void dfs(long long now, long long fa, long long from) {
  siz[from] = 1;
  for (long long i = head[now]; i; i = nxt[i]) {
    if (to[i] == fa) continue;
    dfs(to[i], now, i);
    siz[from] += siz[i];
    dp[from] += dp[i];
    dp[from] %= 998244353;
  }
  dp[from] *= siz[from];
  dp[from] %= 998244353;
  dp[from] += siz[from] * siz[from] % 998244353;
  dp[from] %= 998244353;
  insert(dp[from]);
}
void df5(long long now, long long fa) {
  long long sum = 0;
  for (long long i = head[now]; i; i = nxt[i]) {
    sum += dp[i];
    sum %= 998244353;
  }
  for (long long i = head[now]; i; i = nxt[i]) {
    if (to[i] == fa) continue;
    siz[i ^ 1] = n - siz[i];
    dp[i ^ 1] = (sum - dp[i] + 998244353) % 998244353;
    dp[i ^ 1] *= siz[i ^ 1];
    dp[i ^ 1] %= 998244353;
    dp[i ^ 1] += siz[i ^ 1] * siz[i ^ 1] % 998244353;
    dp[i ^ 1] %= 998244353;
    df5(to[i], now);
  }
}
void solve(long long now, long long fa) {
  for (long long i = head[now]; i; i = nxt[i]) {
    if (to[i] == fa) continue;
    insert(dp[i ^ 1]);
    remove(dp[i]);
    if (ans > mx) {
      mx = ans;
      pos = to[i];
    }
    solve(to[i], now);
    remove(dp[i ^ 1]);
    insert(dp[i]);
  }
}
signed main() {
  scanf("%lld", &n);
  for (long long i = 1; i < n; i++) {
    long long a, b;
    scanf("%lld%lld", &a, &b);
    add(a, b);
    add(b, a);
  }
  dfs(1, 0, 0);
  df5(1, 0);
  mx = ans;
  pos = 1;
  solve(1, 0);
  printf("%lld\n", pos);
  return 0;
}
