#include <bits/stdc++.h>
using namespace std;
const long long mod = 1000000007;
unsigned long long powmod(unsigned long long a, int b) {
  unsigned long long res = 1;
  assert(b >= 0);
  for (; b; b >>= 1) {
    if (b & 1) res = res * a;
    a = a * a;
  }
  return res;
}
const int N = 101000;
vector<pair<unsigned long long, int> > h[N];
unsigned long long pw[2 * N], hv[N], h2[N], hw[N];
map<unsigned long long, int> hs;
int ansv, ansp, n, u, v, sz[N];
vector<int> e[N];
void dfs(int u, int f) {
  for (auto v : e[u]) {
    if (v == f) continue;
    dfs(v, u);
    h[u].push_back(make_pair(hv[v], sz[v]));
    sz[u] += sz[v];
  }
  sz[u]++;
  sort((h[u]).begin(), (h[u]).end());
  hv[u] = 1;
  for (auto p : h[u]) hv[u] = hv[u] * pw[2 * p.second] + p.first;
  hv[u] = hv[u] * 233333 + 2;
}
unsigned long long inv = 2831921843306989789ull;
void dfs2(int u, int f) {
  if (f != 0) h[u].push_back(make_pair(h2[u], n - sz[u]));
  sort((h[u]).begin(), (h[u]).end());
  int m = ((int)(h[u]).size());
  unsigned long long hs = 1;
  for (int i = m - 1; i >= 0; i--)
    hw[i] = h[u][i].first * hs, hs = hs * pw[2 * h[u][i].second];
  hw[m] = 0;
  for (int i = m - 1; i >= 0; i--) hw[i] = hw[i] + hw[i + 1];
  for (auto v : e[u]) {
    if (v == f) continue;
    int p = lower_bound((h[u]).begin(), (h[u]).end(), make_pair(hv[v], sz[v])) -
            h[u].begin();
    h2[v] = pw[2 * (n - sz[v]) - 1] +
            (hw[p + 1] + (hw[0] - hw[p]) * powmod(inv, 2 * sz[v])) * 233333 + 2;
  }
  for (auto v : e[u]) {
    if (v == f) continue;
    dfs2(v, u);
  }
}
void del(unsigned long long v) {
  hs[v]--;
  if (hs[v] == 0) hs.erase(v);
}
void dfs3(int u, int f) {
  if (((int)(hs).size()) > ansv) {
    ansv = ((int)(hs).size());
    ansp = u;
  }
  for (auto v : e[u]) {
    if (v == f) continue;
    del(hv[v]);
    hs[h2[v]]++;
    dfs3(v, u);
    del(h2[v]);
    hs[hv[v]]++;
  }
}
int main() {
  scanf("%d", &n);
  pw[0] = 1;
  for (int i = 1; i < 2 * n + 1; i++) pw[i] = pw[i - 1] * 233333;
  for (int i = 1; i < n; i++) {
    scanf("%d%d", &u, &v);
    e[u].push_back(v);
    e[v].push_back(u);
  }
  dfs(1, 0);
  dfs2(1, 0);
  for (int i = 2; i < n + 1; i++) hs[hv[i]]++;
  ansp = 1;
  ansv = ((int)(hs).size());
  dfs3(1, 0);
  printf("%d\n", ansp);
}
