#include <bits/stdc++.h>
using namespace std;
int N, lv[101010];
int deg[101010], chk[101010], rem;
vector<int> con[101010], que[101010], adj[101010];
int col[101010], ccn, cb[101010];
unordered_map<int, int> mp;
int hsh(vector<int> &v) {
  int x = 1;
  for (int t : v) x = x * (N + 1) + t;
  return x;
}
int main() {
  scanf("%d", &N), rem = N;
  for (int i = N; --i;) {
    int s, e;
    scanf("%d%d", &s, &e);
    deg[s]++, con[s].push_back(e);
    deg[e]++, con[e].push_back(s);
  }
  for (int i = 1; i <= N; i++) {
    if (deg[i] <= 1) {
      col[i] = 1, cb[1]++;
      que[0].push_back(i), chk[i] = 1, rem--;
    }
  }
  ccn = 1;
  int cyc;
  for (cyc = 1; rem; cyc++) {
    for (int s : que[cyc - 1]) {
      for (int e : con[s]) {
        if (chk[e]) continue;
        deg[e]--, adj[e].push_back(col[s]);
        if (deg[e] == 1) que[cyc].push_back(e);
      }
    }
    for (int i : que[cyc]) {
      sort(adj[i].begin(), adj[i].end());
      int h = hsh(adj[i]);
      int hv = mp[h];
      if (hv == 0)
        col[i] = ++ccn, mp[h] = ccn, cb[ccn]++;
      else
        col[i] = hv, cb[hv]++;
      chk[i] = cyc + 1, rem--;
    }
  }
  for (int t = cyc - 1; t >= 0; t--) {
    for (int s : que[t]) {
      if (cb[col[s]] > 1) lv[s]++;
      for (int e : con[s]) {
        if (chk[s] > chk[e]) lv[e] = lv[s];
      }
    }
  }
  int mx = 0, mxi = 1;
  for (int i = 1; i <= N; i++) {
    if (mx < lv[i]) mx = lv[i], mxi = i;
  }
  printf("%d", mxi);
  return 0;
}
