10
6 8
3 10
1 9
6 1
8 2
5 7
3 6
10 4
3 5
 1
 5
1 2
2 3
3 4
4 5
 7
2 3
2 6
1 2
3 7
6 5
3 4
 10
8 4
8 10
8 1
8 2
5 9
5 3
5 7
8 5
5 6
 10
8 6
3 4
10 9
7 10
1 3
4 2
6 1
5 8
9 5
 10
1 10
6 9
5 4
1 3
1 2
3 8
6 7
8 6
1 5
 20
13 4
7 6
9 13
9 2
9 16
4 18
16 5
11 15
16 14
13 12
13 8
16 17
7 1
9 19
17 3
15 20
1 11
2 7
5 10
 3
1 2
1 3
 50
18 47
18 12
42 16
21 44
43 39
20 27
25 1
11 29
9 24
19 42
3 34
16 38
14 48
23 41
8 43
29 2
40 4
45 36
43 9
49 3
41 17
41 15
35 49
43 20
5 32
34 46
8 21
43 45
29 40
39 26
27 33
24 50
38 7
39 19
43 31
24 10
3 14
39 22
43 23
47 13
20 11
25 8
16 30
44 18
19 37
39 5
49 28
25 35
46 6
 15
11 2
5 13
9 4
5 7
11 5
13 14
2 10
3 11
7 1
7 6
10 15
9 12
2 9
10 8
 31
15 2
23 19
11 4
26 6
1 20
14 11
19 13
26 12
12 27
20 14
22 21
4 16
10 18
5 23
4 31
12 8
2 17
19 30
14 26
2 28
22 7
23 9
20 5
5 15
9 29
15 10
6 25
6 24
9 3
11 22
 63
34 40
43 62
33 43
49 6
17 47
26 13
35 15
40 16
17 44
37 34
18 55
57 10
16 14
39 56
36 5
4 33
4 59
54 24
37 45
21 31
57 2
19 8
43 41
49 48
15 19
35 4
15 63
30 50
11 30
59 18
20 46
18 1
33 17
31 22
40 54
63 49
29 25
46 9
16 3
42 23
59 7
54 53
42 38
8 60
8 58
7 51
36 28
63 36
21 57
25 37
45 20
25 35
19 26
20 42
30 32
11 39
7 12
31 52
45 21
26 27
34 11
46 61

9
 1
 1
 1
 1
 2
 10
 18
 2
 13
 1
 3
 1

#include <bits/stdc++.h>
using namespace std;
template <typename T>
T getint() {
  T x = 0, p = 1;
  char ch;
  do {
    ch = getchar();
  } while (ch <= ' ');
  if (ch == '-') p = -1, ch = getchar();
  while (ch >= '0' && ch <= '9') x = x * 10 + ch - '0', ch = getchar();
  return x * p;
}
mt19937 gen(chrono::system_clock::now().time_since_epoch().count());
template <typename T1, typename T2>
bool umin(T1 &x, const T2 &y) {
  if (x > y) return x = y, true;
  return false;
}
template <typename T1, typename T2>
bool umax(T1 &x, const T2 &y) {
  if (x < y) return x = y, true;
  return false;
}
const int maxn = (int)3e5 + 10;
const int inf = (int)1e9 + 5;
const long long llinf = (long long)1e18 + 5;
const double pi = acos(-1.0);
vector<int> g[maxn];
vector<int> z[maxn];
map<pair<long long, long long>, int> have;
int num[maxn];
int cur = 1;
long long h[maxn];
long long pw[maxn];
long long pw2[maxn];
long long mod, mod2, base, base2, inv, inv2;
long long binpow(long long x, long long n, long long mod) {
  long long ret = 1;
  while (n) {
    if (n & 1) ret = (ret * x) % mod;
    x = (x * x) % mod;
    n /= 2;
  }
  return ret;
}
int cnt[maxn];
int all;
void add(int x, int d) {
  if (x == 0) return;
  if (cnt[x] == 0 && d == 1) all++;
  if (cnt[x] == 1 && d == -1) all--;
  cnt[x] += d;
}
void dfs(int v, int par = -1) {
  if (par != -1) g[v].erase(find((g[v]).begin(), (g[v]).end(), par));
  for (int x : g[v]) {
    dfs(x, v);
    z[v].push_back(num[x]);
  }
  sort((z[v]).begin(), (z[v]).end());
  long long HASH = 0, HASH2 = 0;
  for (int i = (0); i < (z[v].size()); i++) {
    HASH += z[v][i] * pw[i];
    HASH %= mod;
    HASH2 += z[v][i] * pw2[i];
    HASH2 %= mod2;
  }
  if (!have.count(make_pair(HASH, HASH2))) have[make_pair(HASH, HASH2)] = cur++;
  num[v] = have[make_pair(HASH, HASH2)];
  add(num[v], +1);
}
void print() {
  for (int i = (0); i < (30); i++)
    if (cnt[i]) cout << i << ",";
  cout << endl;
}
int ans = -1;
int res;
void dfs2(int v, int X) {
  vector<pair<int, int> > t;
  for (int x : g[v]) t.push_back(make_pair(num[x], x));
  if (X != 0) t.push_back(make_pair(X, -1));
  sort((t).begin(), (t).end());
  vector<long long> HASH(t.size()), HASH2(t.size());
  for (int i = (0); i < (t.size()); i++) {
    HASH[i] += t[i].first * pw[i];
    HASH2[i] += t[i].first * pw2[i];
    if (i > 0) HASH[i] += HASH[i - 1], HASH2[i] += HASH2[i - 1];
    HASH[i] %= mod;
    HASH2[i] %= mod2;
  }
  if (!have.count(make_pair(HASH.back(), HASH2.back())))
    have[make_pair(HASH.back(), HASH2.back())] = cur++;
  add(X, +1);
  add(num[v], -1);
  add(have[make_pair(HASH.back(), HASH2.back())], +1);
  if (umax(ans, all)) {
    res = v;
  }
  add(have[make_pair(HASH.back(), HASH2.back())], -1);
  for (int i = (0); i < (t.size()); i++) {
    if (t[i].second == -1) continue;
    long long H1 =
        (i == 0 ? 0 : HASH[i - 1]) + (i + 1 < t.size() ? HASH[i + 1] : 0) * inv;
    H1 %= mod;
    long long H2 = (i == 0 ? 0 : HASH2[i - 1]) +
                   (i + 1 < t.size() ? HASH2[i + 1] : 0) * inv2;
    H2 %= mod;
    if (!have.count(make_pair(H1, H2))) have[make_pair(H1, H2)] = cur++;
    dfs2(t[i].second, have[make_pair(H1, H2)]);
  }
  add(X, -1);
  add(num[v], +1);
}
bool prime(long long x) {
  for (long long i = 2; i * i <= x; ++i)
    if (x % i == 0) return false;
  return true;
}
int main() {
  mod = gen() % 2000000000;
  mod2 = gen() % 2000000000;
  base = 300000 + gen() % 100000;
  base2 = 300000 + gen() % 100000;
  while (!prime(mod)) mod++;
  while (!prime(mod2)) mod2++;
  while (!prime(base)) base++;
  while (!prime(base2)) base2++;
  inv = binpow(base, mod - 2, mod);
  inv2 = binpow(base2, mod2 - 2, mod2);
  pw[0] = pw2[0] = 1;
  for (int i = (1); i < (maxn); i++) {
    pw[i] = (pw[i - 1] * base) % mod;
    pw2[i] = (pw2[i - 1] * base2) % mod2;
  }
  int n = getint<int>();
  if (n == 1) {
    cout << 1 << endl;
    return 0;
  }
  for (int i = (0); i < (n - 1); i++) {
    int x = getint<int>();
    int y = getint<int>();
    g[x].push_back(y);
    g[y].push_back(x);
  }
  dfs(1, -1);
  dfs2(1, 0);
  cout << res << endl;
  return 0;
}
