#include <bits/stdc++.h>
using namespace std;
int mod = 1000000007;
int rnd[101010];
void pre() {
  mt19937 mt(time(NULL));
  uniform_int_distribution<int> uni(0, mod - 1);
  for (int i = 0; i < 101010; i++) rnd[i] = uni(mt);
}
int modpow(int a, long long b) {
  int ret = 1;
  while (b > 0) {
    if (b & 1) ret = 1LL * ret * a % mod;
    a = 1LL * a * a % mod;
    b >>= 1;
  }
  return ret;
}
int modinv(int a) { return modpow(a, mod - 2); }
map<int, int> hm;
int cnt = 0;
void add(int h) {
  if (hm[h] == 0) cnt++;
  hm[h]++;
}
void del(int h) {
  assert(0 < hm[h]);
  hm[h]--;
  if (hm[h] == 0) cnt--;
}
int N;
vector<int> E[101010];
int D[101010];
int H[101010];
void dfs(int cur, int par) {
  vector<int> hashs;
  for (int to : E[cur])
    if (to != par) {
      dfs(to, cur);
      hashs.push_back(H[to]);
      D[cur] = max(D[cur], D[to] + 1);
    }
  int ret = 1;
  for (int h : hashs) ret = (1LL * ret * ((h + rnd[D[cur]]) % mod)) % mod;
  add(ret);
  H[cur] = ret;
}
pair<int, int> ans;
void dfs2(int cur, int par) {
  int bak = H[cur];
  del(bak);
  ans = max(ans, {cnt, cur});
  vector<int> hei;
  hei.push_back(0);
  for (int to : E[cur]) hei.push_back(D[to] + 1);
  sort(hei.begin(), hei.end(), greater<int>());
  vector<int> hashs;
  for (int to : E[cur]) hashs.push_back(H[to]);
  int ha[2] = {1, 1};
  for (int i = 0; i < 2; i++) {
    int h = hei[i];
    for (int hh : hashs) {
      ha[i] = (1LL * ha[i] * ((hh + rnd[h]) % mod)) % mod;
    }
  }
  for (int to : E[cur]) {
    int idx = 0;
    if (hei[0] == D[to] + 1) idx = 1;
    int h = hei[idx];
    int has = (1LL * ha[idx] * modinv((H[to] + rnd[h]) % mod)) % mod;
    D[cur] = h;
    H[cur] = has;
    if (to == par) continue;
    add(has);
    dfs2(to, cur);
    del(has);
  }
  add(bak);
}
int main() {
  pre();
  cin >> N;
  for (int i = 0; i < N - 1; i++) {
    int a, b;
    scanf("%d %d", &a, &b);
    E[a].push_back(b);
    E[b].push_back(a);
  }
  dfs(1, 0);
  dfs2(1, 0);
  if (N == 1)
    cout << 1 << endl;
  else
    cout << ans.second << endl;
}
