#include <bits/stdc++.h>
using namespace std;
const int M1 = 1e9 + 7;
const int M2 = 1e9 + 33;
const int P = 13;
const int Q = 1299821;
int IP1, IP2;
int pw(int x, int y, int mod) {
  int res = 1;
  while (y) {
    if (y & 1) res = (long long)res * x % mod;
    x = (long long)x * x % mod;
    y >>= 1;
  }
  return res;
}
vector<int> E[100010];
int n;
pair<int, int> H[100010], R[100010];
void add(pair<int, int> &a, pair<int, int> b) {
  a.first = (a.first + b.first) % M1;
  a.second = (a.second + b.second) % M2;
}
void mul(pair<int, int> &a, pair<int, int> b) {
  a.first = ((long long)a.first * b.first) % M1;
  a.second = ((long long)a.second * b.second) % M2;
}
void dfs(int x, int fa) {
  vector<pair<int, int> > SH;
  for (int e : E[x])
    if (e != fa) {
      dfs(e, x);
      SH.push_back(H[e]);
    }
  H[x] = pair<int, int>(1, 1);
  if ((int)SH.size() == 0) {
    return;
  }
  sort(SH.begin(), SH.end());
  pair<int, int> p = pair<int, int>(P, P), mu = pair<int, int>(Q, Q);
  for (int i = 0; i < (int)SH.size(); i++) {
    mul(mu, p);
    pair<int, int> temp = mu;
    mul(temp, SH[i]);
    add(H[x], temp);
  }
}
void dfs2(int x, int fa, pair<int, int> a) {
  R[x] = a;
  vector<tuple<int, int, int> > SH;
  if (fa != -1) SH.push_back(tuple<int, int, int>(a.first, a.second, fa));
  for (int e : E[x])
    if (e != fa) {
      SH.push_back(tuple<int, int, int>(H[e].first, H[e].second, e));
    }
  sort(SH.begin(), SH.end());
  pair<int, int> p = pair<int, int>(P, P), mu = pair<int, int>(Q, Q);
  for (int i = 0; i < (int)SH.size(); i++) {
    mul(mu, p);
    pair<int, int> temp = mu;
    mul(temp, pair<int, int>(get<0>(SH[i]), get<1>(SH[i])));
    get<0>(SH[i]) = temp.first;
    get<1>(SH[i]) = temp.second;
  }
  vector<pair<int, int> > sum;
  sum.resize((int)SH.size());
  for (int i = 0; i < (int)SH.size(); i++) sum[i].first = sum[i].second = 0;
  add(sum[(int)SH.size() - 1],
      pair<int, int>(get<0>(SH.back()), get<1>(SH.back())));
  for (int i = (int)SH.size() - 2; i >= 0; i--) {
    add(sum[i], sum[i + 1]);
    add(sum[i], pair<int, int>(get<0>(SH[i]), get<1>(SH[i])));
  }
  pair<int, int> now = pair<int, int>(1, 1);
  for (int i = 0; i < (int)SH.size(); i++) {
    int u = get<2>(SH[i]);
    if (u != fa) {
      pair<int, int> g = pair<int, int>(0, 0);
      if (i != (int)SH.size() - 1) {
        g = sum[i + 1];
        mul(g, pair<int, int>(IP1, IP2));
      }
      pair<int, int> temp = now;
      add(temp, g);
      dfs2(u, x, temp);
    }
    add(now, pair<int, int>(get<0>(SH[i]), get<1>(SH[i])));
  }
}
int ans[100010];
map<pair<int, int>, int> S;
void Do(int x, int fa) {
  for (int e : E[x])
    if (e != fa) {
      S[R[e]]++;
      S[H[e]]--;
      if (S[H[e]] == 0) S.erase(H[e]);
      ans[e] = (int)S.size();
      Do(e, x);
      S[R[e]]--;
      S[H[e]]++;
      if (S[R[e]] == 0) S.erase(R[e]);
    }
}
void solve() {
  IP1 = pw(P, M1 - 2, M1);
  IP2 = pw(P, M2 - 2, M2);
  scanf("%d", &n);
  if (n == 1) {
    puts("1");
    return;
  }
  for (int i = 0; i < n - 1; i++) {
    int x, y;
    scanf("%d%d", &x, &y);
    E[x].push_back(y);
    E[y].push_back(x);
  }
  dfs(1, -1);
  dfs2(1, -1, pair<int, int>(0, 0));
  for (int i = 2; i <= n; i++) S[H[i]]++;
  ans[1] = (int)S.size();
  Do(1, -1);
  printf("%d\n", (int)(max_element(ans + 1, ans + 1 + n) - ans));
}
int main() {
  int Tc = 1;
  for (int tc = 1; tc <= Tc; tc++) {
    solve();
  }
  return 0;
}
