#include <bits/stdc++.h>
using namespace std;
vector<vector<int> > tree;
vector<vector<long long> > frw_hash;
vector<vector<long long> > rev_hash;
vector<int> num;
const long long p = 179;
const long long mod = 1791791791l;
const int maxn = 1e6 + 179;
void get_all(int v, int par, unordered_map<long long, int>& ums) {
  int i = 0;
  for (int u : tree[v]) {
    if (u != par) {
      ums[frw_hash[v][i]]++;
      get_all(u, v, ums);
    }
    i++;
  }
}
void dfs(int v, int par, unordered_map<long long, int>& ums) {
  num[v] = ums.size();
  int i = 0;
  for (int u : tree[v]) {
    if (u != par) {
      ums[frw_hash[v][i]]--;
      if (ums[frw_hash[v][i]] == 0) ums.erase(frw_hash[v][i]);
      ums[rev_hash[v][i]]++;
      dfs(u, v, ums);
      ums[rev_hash[v][i]]--;
      if (ums[rev_hash[v][i]] == 0) ums.erase(rev_hash[v][i]);
      ums[frw_hash[v][i]]++;
    }
    i++;
  }
}
int main() {
  long long ppows[maxn];
  ppows[0] = 1;
  for (int i = 1; i < maxn; ++i) ppows[i] = (ppows[i - 1] * p) % mod;
  int n;
  cin >> n;
  tree.resize(n);
  vector<pair<int, int> > edges;
  for (int i = 0; i < n - 1; ++i) {
    int u, v;
    cin >> u >> v;
    u--, v--;
    tree[u].push_back(v);
    tree[v].push_back(u);
    edges.push_back(make_pair(u, v));
    edges.push_back(make_pair(v, u));
  }
  map<pair<int, int>, int> index;
  for (int i = 0; i < 2 * n - 2; ++i) index[edges[i]] = i;
  vector<long long> rem_hh(edges.size(), -1);
  vector<int> sz_of(edges.size(), -1);
  queue<int> q;
  for (int i = 0; i < n; ++i) {
    if (tree[i].size() == 1) {
      rem_hh[index[make_pair(tree[i][0], i)]] = ('(' * p + ')') % mod;
      sz_of[index[make_pair(tree[i][0], i)]] = 1;
      q.push(index[make_pair(tree[i][0], i)]);
    }
  }
  vector<long long> hash_of(edges.size(), -1);
  vector<int> out(n, 0);
  while (!q.empty()) {
    int a = q.front();
    q.pop();
    if (hash_of[a] != -1) continue;
    hash_of[a] = rem_hh[a];
    int v = edges[a].first;
    out[v]++;
    if (out[v] == tree[v].size() - 1) {
      int u = -1;
      vector<long long> known_outer_hashes;
      vector<int> known_subtree_sizes;
      for (int w : tree[v]) {
        if (hash_of[index[make_pair(v, w)]] == -1)
          u = w;
        else {
          known_outer_hashes.push_back(hash_of[index[make_pair(v, w)]]);
          known_subtree_sizes.push_back(sz_of[index[make_pair(v, w)]]);
        }
      }
      vector<int> ind(known_outer_hashes.size());
      iota(ind.begin(), ind.end(), 0);
      sort(ind.begin(), ind.end(), [&](const int& i, const int& j) -> bool {
        return known_outer_hashes[i] < known_outer_hashes[j];
      });
      vector<int> szs;
      vector<long long> next_hh;
      for (int i = 0; i < known_outer_hashes.size(); ++i) {
        next_hh.push_back(known_outer_hashes[ind[i]]);
        szs.push_back(known_subtree_sizes[ind[i]]);
      }
      int i = index[make_pair(u, v)];
      rem_hh[i] = '(';
      sz_of[i] = 1;
      for (int j = 0; j < next_hh.size(); ++j) {
        rem_hh[i] = (rem_hh[i] * ppows[2 * szs[j]]) % mod;
        rem_hh[i] = (rem_hh[i] + next_hh[j]) % mod;
        sz_of[i] += szs[j];
      }
      rem_hh[i] = (rem_hh[i] * p + ')') % mod;
      q.push(i);
      continue;
    }
    if (out[v] != tree[v].size()) continue;
    vector<long long> outer_hashes;
    vector<int> outer_subtree_sizes;
    for (int w : tree[v]) {
      outer_hashes.push_back(hash_of[index[make_pair(v, w)]]);
      outer_subtree_sizes.push_back(sz_of[index[make_pair(v, w)]]);
    }
    vector<int> ind(outer_hashes.size());
    iota(ind.begin(), ind.end(), 0);
    sort(ind.begin(), ind.end(), [&](const int& i, const int& j) -> bool {
      return outer_hashes[i] < outer_hashes[j];
    });
    vector<long long> next_hh;
    vector<int> szs, rev(outer_hashes.size());
    for (int i = 0; i < outer_hashes.size(); ++i) {
      rev[ind[i]] = i;
      next_hh.push_back(outer_hashes[ind[i]]);
      szs.push_back(outer_subtree_sizes[ind[i]]);
    }
    vector<long long> pref_hh(next_hh.size() + 1, 0);
    pref_hh[0] = '(';
    for (int i = 1; i < next_hh.size() + 1; ++i) {
      pref_hh[i] =
          (pref_hh[i - 1] * ppows[2 * szs[i - 1]] + next_hh[i - 1]) % mod;
    }
    pref_hh.push_back((pref_hh.back() * p + ')') % mod);
    vector<long long> suf_hh(next_hh.size() + 2, 0);
    vector<int> suf_sz(next_hh.size() + 2, 0);
    suf_hh.back() = ')';
    for (int i = next_hh.size(); i > 0; i--) {
      suf_hh[i] =
          (suf_hh[i + 1] + next_hh[i - 1] * ppows[2 * suf_sz[i + 1] + 1]) % mod;
      suf_sz[i] = suf_sz[i + 1] + szs[i - 1];
    }
    suf_hh[0] = (suf_hh[1] + '(' * ppows[2 * suf_sz[1] + 1]) % mod;
    suf_sz[0] = suf_sz[1];
    for (int i = 0; i < next_hh.size(); ++i) {
      int u = tree[v][ind[i]];
      if (rem_hh[index[make_pair(u, v)]] == -1) {
        sz_of[index[make_pair(u, v)]] = n - sz_of[index[make_pair(v, u)]];
        rem_hh[index[make_pair(u, v)]] =
            (pref_hh[i] * ppows[2 * suf_sz[i + 2] + 1] + suf_hh[i + 2]) % mod;
        q.push(index[make_pair(u, v)]);
      }
    }
  }
  frw_hash.resize(n);
  rev_hash.resize(n);
  num.resize(n);
  for (int i = 0; i < n; ++i) {
    for (int v : tree[i]) {
      frw_hash[i].push_back(hash_of[index[make_pair(i, v)]]);
      rev_hash[i].push_back(hash_of[index[make_pair(v, i)]]);
    }
  }
  unordered_map<long long, int> ump;
  get_all(0, -1, ump);
  dfs(0, -1, ump);
  cout << distance(num.begin(), max_element(num.begin(), num.end())) + 1
       << endl;
  return 0;
}
