#include <bits/stdc++.h>
using namespace std;
const int MOD[] = {1000000007, 1000000009};
struct Hash {
  int val[2];
  Hash(int x = 0) { val[0] = val[1] = x; }
};
Hash operator+(const Hash &a, const Hash &b) {
  Hash res;
  for (int i = (0); i <= (1); ++i) res.val[i] = (a.val[i] + b.val[i]) % MOD[i];
  return res;
}
Hash operator-(const Hash &a, const Hash &b) {
  Hash res;
  for (int i = (0); i <= (1); ++i)
    res.val[i] = (a.val[i] + MOD[i] - b.val[i]) % MOD[i];
  return res;
}
Hash operator*(const Hash &a, const Hash &b) {
  Hash res;
  for (int i = (0); i <= (1); ++i)
    res.val[i] = ((long long)a.val[i] * b.val[i]) % MOD[i];
  return res;
}
bool operator<(const Hash &a, const Hash &b) {
  return make_pair(a.val[0], a.val[1]) < make_pair(b.val[0], b.val[1]);
}
bool operator==(const Hash &a, const Hash &b) {
  for (int i = (0); i <= (1); ++i)
    if (a.val[i] != b.val[i]) return false;
  return true;
}
struct Task {
  int n;
  vector<vector<int> > g;
  Task() {
    cin >> n;
    g = vector<vector<int> >(n);
    for (int i = (1); i <= (n - 1); ++i) {
      int u, v;
      cin >> u >> v;
      u--;
      v--;
      g[u].push_back(v);
      g[v].push_back(u);
    }
  }
  vector<Hash> hashDown, hashUp;
  void dfsDown(int v, int par) {
    for (int u : g[v])
      if (u != par) {
        dfsDown(u, v);
        hashDown[v] = hashDown[v] + hashDown[u] * hashDown[u] * hashDown[u];
      }
  }
  void dfsUp(int v, int par) {
    for (int u : g[v])
      if (u != par) {
        hashUp[u] = hashDown[v] - hashDown[u] * hashDown[u] * hashDown[u];
        hashUp[u] = hashUp[u] + hashUp[v] * hashUp[v] * hashUp[v];
        dfsUp(u, v);
      }
  }
  int best, ans = -1;
  map<Hash, int> cnt;
  void change(Hash hsh, int chg) {
    cnt[hsh] += chg;
    if (chg == -1 && cnt[hsh] == 0) {
      cnt.erase(hsh);
    }
  }
  void dfsSolve(int v, int par) {
    int here = cnt.size();
    if (here > ans) {
      ans = here;
      best = v;
    }
    for (int u : g[v])
      if (u != par) {
        change(hashDown[u], -1);
        change(hashUp[u], 1);
        dfsSolve(u, v);
        change(hashDown[u], 1);
        change(hashUp[u], -1);
      }
  }
  void solve() {
    hashDown = vector<Hash>(n, 1);
    hashUp = vector<Hash>(n);
    dfsDown(0, -1);
    dfsUp(0, -1);
    for (int i = (1); i <= (n - 1); ++i) {
      cnt[hashDown[i]]++;
    }
    dfsSolve(0, -1);
    cout << 1 + best;
  }
};
int main() {
  ios_base::sync_with_stdio(0);
  Task().solve();
  return 0;
}
