#include <bits/stdc++.h>
using namespace std;
template <typename T, typename U>
ostream& operator<<(ostream& os, const pair<T, U>& _p) {
  return os << "(" << _p.first << "," << _p.second << ")";
}
template <typename T>
ostream& operator<<(ostream& os, const vector<T>& _V) {
  bool f = true;
  os << "[";
  for (auto v : _V) {
    os << (f ? "" : ",") << v;
    f = false;
  }
  return os << "]";
}
template <typename T>
ostream& operator<<(ostream& os, const set<T>& _S) {
  bool f = true;
  os << "(";
  for (auto s : _S) {
    os << (f ? "" : ",") << s;
    f = false;
  }
  return os << ")";
}
template <typename T, typename U>
ostream& operator<<(ostream& os, const map<T, U>& _M) {
  return os << set<pair<T, U>>(_M.begin(), _M.end());
}
const unsigned long long INF = 1000000100;
const long double EPS = 1e-9;
map<pair<unsigned long long, pair<unsigned long long, unsigned long long>>,
    unsigned long long>
    H;
vector<int> V[100100];
int n;
unsigned long long mH[100100];
int Odw[100100], diff;
pair<int, int> ans;
map<int, int> Ile;
unsigned long long S1[100100];
unsigned long long S2[100100];
unsigned long long S3[100100];
unsigned long long HASH(unsigned long long c, unsigned long long a,
                        unsigned long long b) {
  return ((a ^ b) + (c * c * c) + 12344121) ^ 4372321658131;
  if (H.find(make_pair(a, make_pair(b, c))) == H.end()) {
    H[make_pair(a, make_pair(b, c))] = rand();
  }
  return H[make_pair(a, make_pair(b, c))];
}
void dfs(int a) {
  Odw[a] = 1;
  unsigned long long s1 = 4321478328667919ll;
  unsigned long long s2 = 432781477312874ll;
  unsigned long long s3 = 347582818888181ll;
  for (int v : V[a]) {
    if (Odw[v]) continue;
    dfs(v);
    s1 ^= mH[v];
    s2 += mH[v] * mH[v];
    s3 += mH[v] * mH[v] * mH[v];
  }
  mH[a] = HASH(s1, s2, s3);
  S1[a] = s1;
  S2[a] = s2;
  S3[a] = s3;
}
int GW[100100];
void go(int a, unsigned long long gg) {
  Ile[mH[a]]--;
  if (Ile[mH[a]] == 0) diff--;
  ans = max(ans, make_pair(diff, a));
  if (0)
    cerr << diff << " a:" << a << " "
         << "\n";
  GW[a] = 1;
  for (int v : V[a]) {
    if (GW[v]) continue;
    unsigned long long ns1 = (S1[a] ^ mH[v] ^ gg);
    unsigned long long ns2 = (S2[a] - mH[v] * mH[v] + gg * gg);
    unsigned long long ns3 = (S3[a] - mH[v] * mH[v] * mH[v] + gg * gg * gg);
    int nh = HASH(ns1, ns2, ns3);
    if (Ile[nh] == 0) diff++;
    Ile[nh]++;
    go(v, nh);
    Ile[nh]--;
    if (Ile[nh] == 0) diff--;
  }
  Ile[mH[a]]++;
  if (Ile[mH[a]] == 1) diff++;
}
int main() {
  srand(time(NULL));
  scanf("%d", &n);
  for (int(i) = (1); (i) < (n); (i)++) {
    int a, b;
    scanf("%d%d", &a, &b);
    V[a].push_back(b);
    V[b].push_back(a);
  }
  int root = 1;
  dfs(root);
  for (int(i) = (1); (i) <= (n); (i)++) {
    Ile[mH[i]]++;
    if (Ile[mH[i]] == 1) diff++;
  }
  go(root, 0);
  cout << ans.second << endl;
  ;
}
