#include <bits/stdc++.h>
using namespace std;
template <typename T>
inline void next_int(T &x) {
  x = 0;
  char c;
  bool neg = false;
  while (!isdigit(c = getchar()))
    if (c == '-') neg = true;
  do x = x * 10 + c - 48;
  while (isdigit(c = getchar()));
  if (neg) x = -x;
}
template <typename T>
inline void write_int(T x, char last = 0) {
  if (x < 0) putchar('-'), x = abs(x);
  char tmp[20];
  int cnt = 0;
  while (x >= 10) tmp[cnt++] = x % 10 + 48, x /= 10;
  tmp[cnt] = x + 48;
  for (int i = (cnt); i >= (0); --i) putchar(tmp[i]);
  if (last) putchar(last);
}
const int N = (int)1e5 + 5;
int n, res, op;
long long h[N], hp[N], sz[N], cntChild[N];
vector<int> g[N];
class CntMap {
 private:
  map<long long, int> cnt;

 public:
  int size() { return ((int)cnt.size()); }
  void insert(long long x) { ++cnt[x]; }
  void erase(long long x) {
    auto it = cnt.find(x);
    if (it != cnt.end()) {
      --it->second;
      if (!it->second) cnt.erase(it);
    }
  }
} s;
void dfs_prep(int u, int p) {
  sz[u] = h[u] = cntChild[u] = 1;
  for (int i = (0); i < (((int)g[u].size())); ++i) {
    int v = g[u][i];
    if (v == p) continue;
    dfs_prep(v, u);
    sz[u] += sz[v], ++cntChild[u];
    h[u] += h[v] * sz[v] * cntChild[v];
  }
  s.insert(h[u] * sz[u] * cntChild[u]);
}
void dfs_calc(int u, int p) {
  long long hr = h[u] + hp[p] * ((long long)n - sz[u]);
  s.erase(h[u] * sz[u] * cntChild[u]);
  s.insert(hr * n * (cntChild[u] + (long long)(p != 0)));
  if (res < ((int)s.size())) res = ((int)s.size()), op = u;
  s.erase(hr * n * (cntChild[u] + (long long)(p != 0)));
  for (int i = (0); i < (((int)g[u].size())); ++i) {
    int v = g[u][i];
    if (v == p) continue;
    long long tmp = hr - h[v] * sz[v] * cntChild[v];
    s.insert(tmp * ((long long)n - sz[v]) *
             (cntChild[u] - (long long)(p == 0)));
    hp[u] = tmp * (cntChild[u] - (long long)(p == 0));
    dfs_calc(v, u);
    s.erase(tmp * ((long long)n - sz[v]) * (cntChild[u] - (long long)(p == 0)));
  }
  s.insert(h[u] * sz[u] * cntChild[u]);
}
int main() {
  next_int(n);
  for (int i = (1); i < (n); ++i) {
    int u, v;
    next_int(u), next_int(v);
    g[u].push_back(v);
    g[v].push_back(u);
  }
  dfs_prep(1, 0);
  dfs_calc(1, 0);
  write_int(op);
  return 0;
}
