#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using Edge = pair<int, int>;
const ll p = 179;
const ll mod = 1791791791l;
const int maxn = 1e6 + 179;
struct TreeData {
  TreeData(ll h, int s) : hash(h), size(s) {}
  ll hash;
  int size;
  bool operator<(const TreeData& td) const { return hash < td.hash; }
};
int n;
vector<vector<int>> nbrs;
vector<Edge> edges;
map<Edge, ll> hash_of;
void Load() {
  scanf("%d", &n);
  nbrs.resize(n);
  for (int i = 0; i < n - 1; ++i) {
    int a, b;
    scanf("%d%d", &a, &b);
    a--, b--;
    nbrs[a].push_back(b);
    nbrs[b].push_back(a);
    edges.push_back({a, b});
    edges.push_back({b, a});
  }
}
void CollectHashes(int v, int fromv, unordered_map<ll, int>* curhashes) {
  for (int i = 0; i < nbrs[v].size(); ++i) {
    if (nbrs[v][i] != fromv) {
      Edge e(v, nbrs[v][i]);
      ll val = hash_of[e];
      (*curhashes)[val]++;
      CollectHashes(nbrs[v][i], v, curhashes);
    }
  }
}
void EulerTourDFS(int v, int fromv, unordered_map<ll, int>* curhashes, int* ans,
                  int* maxhashes) {
  Edge e(v, fromv);
  Edge ef(fromv, v);
  if (fromv != -1) {
    (*curhashes)[hash_of[ef]]--;
    if ((*curhashes)[hash_of[ef]] == 0) {
      curhashes->erase(hash_of[ef]);
    }
    (*curhashes)[hash_of[e]]++;
  }
  if (curhashes->size() > *maxhashes) {
    *maxhashes = curhashes->size();
    *ans = v;
  }
  for (int i = 0; i < nbrs[v].size(); ++i) {
    if (nbrs[v][i] != fromv) {
      EulerTourDFS(nbrs[v][i], v, curhashes, ans, maxhashes);
    }
  }
  (*curhashes)[hash_of[ef]]++;
  (*curhashes)[hash_of[e]]--;
  if ((*curhashes)[hash_of[e]] == 0) {
    curhashes->erase(hash_of[e]);
  }
}
void Solve() {
  ll ppows[maxn];
  ppows[0] = 1;
  for (int i = 1; i < maxn; ++i) {
    ppows[i] = (ppows[i - 1] * p) % mod;
  }
  queue<Edge> q;
  map<Edge, int> size_of;
  vector<int> out(n, 0);
  for (int i = 0; i < edges.size(); ++i) {
    if (nbrs[edges[i].second].size() == 1) {
      hash_of[edges[i]] = '(' * p + ')';
      size_of[edges[i]] = 1;
      out[edges[i].first]++;
      q.push(edges[i]);
    }
  }
  vector<bool> fulloutcalc(n, false);
  vector<bool> mostoutcalc(n, false);
  while (!q.empty()) {
    Edge e = q.front();
    q.pop();
    int v = e.first;
    if (out[v] == nbrs[v].size() - 1) {
      if (mostoutcalc[v]) continue;
      mostoutcalc[v] = true;
      int u;
      vector<TreeData> known;
      for (int i = 0; i < nbrs[v].size(); ++i) {
        if (hash_of.count({v, nbrs[v][i]}) == 0) {
          u = nbrs[v][i];
          continue;
        }
        known.push_back({hash_of[{v, nbrs[v][i]}], size_of[{v, nbrs[v][i]}]});
      }
      sort((known).begin(), (known).end());
      Edge ne = {u, v};
      int size = 1;
      hash_of[ne] = '(';
      for (int i = 0; i < known.size(); ++i) {
        hash_of[ne] = (hash_of[ne] * ppows[2 * known[i].size]) % mod;
        hash_of[ne] = (hash_of[ne] + known[i].hash) % mod;
        size += known[i].size;
      }
      hash_of[ne] = (hash_of[ne] * p + ')') % mod;
      size_of[ne] = size;
      out[u]++;
      q.push(ne);
      continue;
    }
    if (out[v] != nbrs[v].size()) {
      continue;
    }
    if (fulloutcalc[v]) continue;
    fulloutcalc[v] = true;
    vector<int> sorted_indices(nbrs[v].size(), 0);
    iota((sorted_indices).begin(), (sorted_indices).end(), 0);
    sort((sorted_indices).begin(), (sorted_indices).end(),
         [v](const ll a, const ll b) {
           Edge e1(v, nbrs[v][a]);
           Edge e2(v, nbrs[v][b]);
           return hash_of[e1] < hash_of[e2];
         });
    vector<ll> pref(nbrs[v].size(), 0), suf(nbrs[v].size(), 0),
        suf_sz(nbrs[v].size(), 0);
    pref[0] = '(';
    for (int i = 1; i < nbrs[v].size(); ++i) {
      pref[i] = (pref[i - 1] *
                 ppows[2 * size_of[{v, nbrs[v][sorted_indices[i - 1]]}]]) %
                mod;
      pref[i] = (pref[i] + hash_of[{v, nbrs[v][sorted_indices[i - 1]]}]) % mod;
    }
    suf[nbrs[v].size() - 1] = ')';
    suf_sz[nbrs[v].size() - 1] = 0;
    for (int i = nbrs[v].size() - 2; i >= 0; --i) {
      suf[i] = (suf[i + 1] + hash_of[{v, nbrs[v][sorted_indices[i + 1]]}] *
                                 ppows[2 * suf_sz[i + 1] + 1]) %
               mod;
      Edge e(v, nbrs[v][sorted_indices[i + 1]]);
      suf_sz[i] = suf_sz[i + 1] + size_of[e];
    }
    for (int i = 0; i < nbrs[v].size(); ++i) {
      Edge e(nbrs[v][sorted_indices[i]], v);
      Edge ef(v, nbrs[v][sorted_indices[i]]);
      if (hash_of[e] == 0) {
        hash_of[e] = (pref[i] * ppows[2 * suf_sz[i] + 1]) % mod;
        hash_of[e] = (hash_of[e] + suf[i]) % mod;
        size_of[e] = n - size_of[ef];
        out[nbrs[v][sorted_indices[i]]]++;
        q.push({nbrs[v][sorted_indices[i]], v});
      }
    }
  }
  unordered_map<ll, int> curhashes;
  CollectHashes(0, -1, &curhashes);
  int ans = curhashes.size(), maxhashes = 0;
  EulerTourDFS(0, -1, &curhashes, &ans, &maxhashes);
  printf("%d\n", ans + 1);
}
int main() {
  Load();
  Solve();
  return 0;
}
