#include <bits/stdc++.h>
using namespace std;
bool debug = 0;
int n, m, k;
int dx[4] = {0, 1, 0, -1}, dy[4] = {1, 0, -1, 0};
string direc = "RDLU";
long long ln, lk, lm;
void etp(bool f = 0) {
  puts(f ? "YES" : "NO");
  exit(0);
}
void addmod(int &x, int y, int mod = 1000000007) {
  x += y;
  if (x >= mod) x -= mod;
  assert(x >= 0 && x < mod);
}
void et() {
  puts("-1");
  exit(0);
}
vector<int> mp[100005];
int hs[100005], cnt;
unordered_map<int, int> idm;
int p3(int x) { return (long long)x * x % 1000000007 * x % 1000000007; }
void dfs(int x, int pa) {
  hs[x] = 321239;
  for (int c : mp[x])
    if (c != pa) {
      dfs(c, x);
      addmod(hs[x], p3(hs[c]));
    }
  if (x != 1) {
    if (idm.find(hs[x]) == idm.end()) cnt++;
    idm[hs[x]]++;
  }
}
int ans, mx;
void dfs2(int x, int pa, int H) {
  idm[hs[x]]--;
  if (idm[hs[x]] == 0) cnt--;
  idm[H]++;
  if (idm[H] == 1) cnt++;
  if (cnt > mx) {
    mx = cnt;
    ans = x;
  }
  for (int c : mp[x])
    if (c != pa) {
      dfs2(c, x,
           ((long long)hs[x] + p3(H) - p3(hs[c]) + 1000000007) % 1000000007);
    }
  idm[H]--;
  if (idm[H] == 0) cnt--;
  idm[hs[x]]++;
  if (idm[hs[x]] == 1) cnt++;
}
void fmain(int tid) {
  scanf("%d", &n);
  for (int i = 0, u, v; i < n - 1; i++) {
    scanf("%d%d", &u, &v);
    mp[u].push_back(v);
    mp[v].push_back(u);
  };
  dfs(1, 0);
  ans = 1;
  mx = cnt;
  for (int c : mp[1]) {
    dfs2(c, 1, (hs[1] - p3(hs[c]) + 1000000007) % 1000000007);
  }
  printf("%d\n", ans);
}
int main() {
  int t = 1;
  for (int(i) = 1; (i) <= (int)(t); (i)++) {
    fmain(i);
  }
  return 0;
}
