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

import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.util.Arrays;
import java.util.Random;
import java.util.ArrayList;
import java.io.OutputStreamWriter;
import java.io.OutputStream;
import java.io.PrintStream;
import java.io.IOException;
import java.io.UncheckedIOException;
import java.util.List;
import java.io.Closeable;
import java.io.Writer;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 */
public class Main {
    public static void main(String[] args) throws Exception {
        Thread thread = new Thread(null, new TaskAdapter(), "", 1 << 29);
        thread.start();
        thread.join();
    }

    static class TaskAdapter implements Runnable {
        @Override
        public void run() {
            InputStream inputStream = System.in;
            OutputStream outputStream = System.out;
            FastInput in = new FastInput(inputStream);
            FastOutput out = new FastOutput(outputStream);
            DTimofeyAndAFlatTree solver = new DTimofeyAndAFlatTree();
            solver.solve(1, in, out);
            out.close();
        }
    }

    static class DTimofeyAndAFlatTree {
        Debug debug = new Debug(true);
        HashData[] hds;
        PartialHash[] phs;
        long mask = (1L << 32) - 1;
        int vertex = -1;
        int vertexVal = -1;
        LongHashMap map = new LongHashMap((int) 2e6, true);
        int nonZeroCnt = 0;

        public void solve(int testNumber, FastInput in, FastOutput out) {
            int n = in.readInt();
            Node[] nodes = new Node[n];
            for (int i = 0; i < n; i++) {
                nodes[i] = new Node();
                nodes[i].id = i;
            }
            for (int i = 0; i < n - 1; i++) {
                Node a = nodes[in.readInt() - 1];
                Node b = nodes[in.readInt() - 1];
                a.adj.add(b);
                b.adj.add(a);
            }

            for (int i = 0; i < 1; i++) {
                hds = new HashData[]{new HashData((int) 1e5, (int) 1e9 + 7, RandomWrapper.INSTANCE.nextInt(3, (int) (1e9 + 6))), new HashData((int) 1e5, (int) 1e9 + 7, RandomWrapper.INSTANCE.nextInt(3, (int) (1e9 + 6)))};
                phs = new PartialHash[]{new PartialHash(hds[0]), new PartialHash(hds[1])};
                nonZeroCnt = 0;
                dfsForHash(nodes[0], null);
                dfsForVertex(nodes[0], null, 0);
            }


            debug.debug("vertexVal", vertexVal);
            out.println(vertex + 1);
        }

        public void update(int vertex) {
            if (nonZeroCnt > vertexVal) {
                vertexVal = nonZeroCnt;
                this.vertex = vertex;
            }
        }

        public void add(long x) {
            long val = map.get(x);
            map.put(x, val + 1);
            if (val == 0) {
                nonZeroCnt++;
            }
        }

        public void remove(long x) {
            long val = map.get(x);
            map.put(x, val - 1);
            if (val == 1) {
                nonZeroCnt--;
            }
        }

        public int hashWithout(int h, int i, int l, int r) {
            int left = phs[h].hash(l, i - 1, false);
            int right = phs[h].hash(i + 1, r, false);
            int leftSize = i - l;
            int rightSize = r - i;
            right = hds[h].mod.mul(right, hds[h].pow[leftSize]);
            int ans = hds[h].mod.plus(left, right);
            ans = hds[h].mod.plus(ans, hds[h].pow[leftSize + rightSize]);
            return ans;
        }

        public void dfsForHash(Node root, Node p) {
            root.hash = new LongArrayList(root.adj.size());
            for (Node node : root.adj) {
                if (node == p) {
                    continue;
                }
                dfsForHash(node, root);
                root.hash.add(node.hashVal);
            }
            root.hash.sort();
            phs[0].populate(i -> hds[0].hash(root.hash.get(i)), 0, root.hash.size() - 1);
            phs[1].populate(i -> hds[1].hash(root.hash.get(i)), 0, root.hash.size() - 1);
            for (PartialHash ph : phs) {
                root.hashVal = (root.hashVal << 32) | (ph.hash(0, root.hash.size() - 1, true) & mask);
            }
            add(root.hashVal);
        }

        public void dfsForVertex(Node root, Node p, long pHash) {
            if (p != null) {
                root.hash.add(pHash);
            }

            long original = root.hashVal;
            root.hash.sort();
            root.hashVal = 0;
            phs[0].populate(i -> hds[0].hash(root.hash.get(i)), 0, root.hash.size() - 1);
            phs[1].populate(i -> hds[1].hash(root.hash.get(i)), 0, root.hash.size() - 1);
            for (PartialHash ph : phs) {
                root.hashVal = (root.hashVal << 32) | (ph.hash(0, root.hash.size() - 1, true) & mask);
            }

            remove(original);
            add(root.hashVal);
            update(root.id);

            for (Node node : root.adj) {
                if (node == p) {
                    continue;
                }
                node.mark = 0;
                int index = root.hash.binarySearch(node.hashVal);
                for (int i = 0; i < 2; i++) {
                    node.mark = (node.mark << 32) | (hashWithout(i, index, 0, root.hash.size() - 1) & mask);
                }
            }

            remove(root.hashVal);
            for (Node node : root.adj) {
                if (node == p) {
                    continue;
                }
                add(node.mark);
                dfsForVertex(node, root, node.mark);
                remove(node.mark);
            }
            add(original);
        }

    }

    static class RandomWrapper {
        private Random random;
        public static final RandomWrapper INSTANCE = new RandomWrapper(new Random());

        public RandomWrapper() {
            this(new Random());
        }

        public RandomWrapper(Random random) {
            this.random = random;
        }

        public int nextInt(int l, int r) {
            return random.nextInt(r - l + 1) + l;
        }

    }

    static class FastInput {
        private final InputStream is;
        private byte[] buf = new byte[1 << 13];
        private int bufLen;
        private int bufOffset;
        private int next;

        public FastInput(InputStream is) {
            this.is = is;
        }

        private int read() {
            while (bufLen == bufOffset) {
                bufOffset = 0;
                try {
                    bufLen = is.read(buf);
                } catch (IOException e) {
                    bufLen = -1;
                }
                if (bufLen == -1) {
                    return -1;
                }
            }
            return buf[bufOffset++];
        }

        public void skipBlank() {
            while (next >= 0 && next <= 32) {
                next = read();
            }
        }

        public int readInt() {
            int sign = 1;

            skipBlank();
            if (next == '+' || next == '-') {
                sign = next == '+' ? 1 : -1;
                next = read();
            }

            int val = 0;
            if (sign == 1) {
                while (next >= '0' && next <= '9') {
                    val = val * 10 + next - '0';
                    next = read();
                }
            } else {
                while (next >= '0' && next <= '9') {
                    val = val * 10 - next + '0';
                    next = read();
                }
            }

            return val;
        }

    }

    static interface LongEntryIterator {
        boolean hasNext();

        void next();

        long getEntryKey();

        long getEntryValue();

    }

    static class ExtGCD {
        public static int extGCD(int a, int b, int[] xy) {
            if (a >= b) {
                return extGCD0(a, b, xy);
            }
            int ans = extGCD0(b, a, xy);
            SequenceUtils.swap(xy, 0, 1);
            return ans;
        }

        private static int extGCD0(int a, int b, int[] xy) {
            if (b == 0) {
                xy[0] = 1;
                xy[1] = 0;
                return a;
            }
            int ans = extGCD0(b, a % b, xy);
            int x = xy[0];
            int y = xy[1];
            xy[0] = y;
            xy[1] = x - a / b * y;
            return ans;
        }

    }

    static interface InverseNumber {
    }

    static class FastOutput implements AutoCloseable, Closeable, Appendable {
        private StringBuilder cache = new StringBuilder(10 << 20);
        private final Writer os;

        public FastOutput append(CharSequence csq) {
            cache.append(csq);
            return this;
        }

        public FastOutput append(CharSequence csq, int start, int end) {
            cache.append(csq, start, end);
            return this;
        }

        public FastOutput(Writer os) {
            this.os = os;
        }

        public FastOutput(OutputStream os) {
            this(new OutputStreamWriter(os));
        }

        public FastOutput append(char c) {
            cache.append(c);
            return this;
        }

        public FastOutput append(int c) {
            cache.append(c);
            return this;
        }

        public FastOutput println(int c) {
            return append(c).println();
        }

        public FastOutput println() {
            cache.append(System.lineSeparator());
            return this;
        }

        public FastOutput flush() {
            try {
                os.append(cache);
                os.flush();
                cache.setLength(0);
            } catch (IOException e) {
                throw new UncheckedIOException(e);
            }
            return this;
        }

        public void close() {
            flush();
            try {
                os.close();
            } catch (IOException e) {
                throw new UncheckedIOException(e);
            }
        }

        public String toString() {
            return cache.toString();
        }

    }

    static class Node {
        List<Node> adj = new ArrayList<>();
        LongArrayList hash;
        long hashVal;
        long mark;
        int id;

        public String toString() {
            return "" + (id + 1);
        }

    }

    static class Randomized {
        public static void shuffle(long[] data, int from, int to) {
            to--;
            for (int i = from; i <= to; i++) {
                int s = nextInt(i, to);
                long tmp = data[i];
                data[i] = data[s];
                data[s] = tmp;
            }
        }

        public static int nextInt(int l, int r) {
            return RandomWrapper.INSTANCE.nextInt(l, r);
        }

    }

    static class Debug {
        private boolean offline;
        private PrintStream out = System.err;

        public Debug(boolean enable) {
            offline = enable && System.getSecurityManager() == null;
        }

        public Debug debug(String name, int x) {
            if (offline) {
                debug(name, "" + x);
            }
            return this;
        }

        public Debug debug(String name, String x) {
            if (offline) {
                out.printf("%s=%s", name, x);
                out.println();
            }
            return this;
        }

    }

    static class LongHashMap {
        private int[] slot;
        private int[] next;
        private long[] keys;
        private long[] values;
        private int alloc;
        private boolean[] removed;
        private int mask;
        private int size;
        private boolean rehash;
        private Hasher hasher = new Hasher();

        public LongHashMap(int cap, boolean rehash) {
            this.mask = (1 << (32 - Integer.numberOfLeadingZeros(cap - 1))) - 1;
            slot = new int[mask + 1];
            next = new int[cap + 1];
            keys = new long[cap + 1];
            values = new long[cap + 1];
            removed = new boolean[cap + 1];
            this.rehash = rehash;
        }

        private void doubleCapacity() {
            int newSize = Math.max(next.length + 10, next.length * 2);
            next = Arrays.copyOf(next, newSize);
            keys = Arrays.copyOf(keys, newSize);
            values = Arrays.copyOf(values, newSize);
            removed = Arrays.copyOf(removed, newSize);
        }

        public void alloc() {
            alloc++;
            if (alloc >= next.length) {
                doubleCapacity();
            }
            next[alloc] = 0;
            removed[alloc] = false;
            size++;
        }

        private void rehash() {
            int[] newSlots = new int[Math.max(16, slot.length * 2)];
            int newMask = newSlots.length - 1;
            for (int i = 0; i < slot.length; i++) {
                if (slot[i] == 0) {
                    continue;
                }
                int head = slot[i];
                while (head != 0) {
                    int n = next[head];
                    int s = hash(keys[head]) & newMask;
                    next[head] = newSlots[s];
                    newSlots[s] = head;
                    head = n;
                }
            }
            this.slot = newSlots;
            this.mask = newMask;
        }

        private int hash(long x) {
            return hasher.hash(x);
        }

        public void put(long x, long y) {
            put(x, y, true);
        }

        public void put(long x, long y, boolean cover) {
            int h = hash(x);
            int s = h & mask;
            if (slot[s] == 0) {
                alloc();
                slot[s] = alloc;
                keys[alloc] = x;
                values[alloc] = y;
            } else {
                int index = findIndexOrLastEntry(s, x);
                if (keys[index] != x) {
                    alloc();
                    next[index] = alloc;
                    keys[alloc] = x;
                    values[alloc] = y;
                } else if (cover) {
                    values[index] = y;
                }
            }
            if (rehash && size >= slot.length) {
                rehash();
            }
        }

        public long getOrDefault(long x, long def) {
            int h = hash(x);
            int s = h & mask;
            if (slot[s] == 0) {
                return def;
            }
            int index = findIndexOrLastEntry(s, x);
            return keys[index] == x ? values[index] : def;
        }

        public long get(long x) {
            return getOrDefault(x, 0);
        }

        private int findIndexOrLastEntry(int s, long x) {
            int iter = slot[s];
            while (keys[iter] != x) {
                if (next[iter] != 0) {
                    iter = next[iter];
                } else {
                    return iter;
                }
            }
            return iter;
        }

        public LongEntryIterator iterator() {
            return new LongEntryIterator() {
                int index = 1;
                int readIndex = -1;


                public boolean hasNext() {
                    while (index <= alloc && removed[index]) {
                        index++;
                    }
                    return index <= alloc;
                }


                public long getEntryKey() {
                    return keys[readIndex];
                }


                public long getEntryValue() {
                    return values[readIndex];
                }


                public void next() {
                    if (!hasNext()) {
                        throw new IllegalStateException();
                    }
                    readIndex = index;
                    index++;
                }
            };
        }

        public String toString() {
            LongEntryIterator iterator = iterator();
            StringBuilder builder = new StringBuilder("{");
            while (iterator.hasNext()) {
                iterator.next();
                builder.append(iterator.getEntryKey()).append("->").append(iterator.getEntryValue()).append(',');
            }
            if (builder.charAt(builder.length() - 1) == ',') {
                builder.setLength(builder.length() - 1);
            }
            builder.append('}');
            return builder.toString();
        }

    }

    static class LongArrayList implements Cloneable {
        private int size;
        private int cap;
        private long[] data;
        private static final long[] EMPTY = new long[0];

        public LongArrayList(int cap) {
            this.cap = cap;
            if (cap == 0) {
                data = EMPTY;
            } else {
                data = new long[cap];
            }
        }

        public LongArrayList(LongArrayList list) {
            this.size = list.size;
            this.cap = list.cap;
            this.data = Arrays.copyOf(list.data, size);
        }

        public LongArrayList() {
            this(0);
        }

        public void ensureSpace(int req) {
            if (req > cap) {
                while (cap < req) {
                    cap = Math.max(cap + 10, 2 * cap);
                }
                data = Arrays.copyOf(data, cap);
            }
        }

        private void checkRange(int i) {
            if (i < 0 || i >= size) {
                throw new ArrayIndexOutOfBoundsException();
            }
        }

        public long get(int i) {
            checkRange(i);
            return data[i];
        }

        public void add(long x) {
            ensureSpace(size + 1);
            data[size++] = x;
        }

        public void addAll(long[] x, int offset, int len) {
            ensureSpace(size + len);
            System.arraycopy(x, offset, data, size, len);
            size += len;
        }

        public void addAll(LongArrayList list) {
            addAll(list.data, 0, list.size);
        }

        public void sort() {
            if (size <= 1) {
                return;
            }
            Randomized.shuffle(data, 0, size);
            Arrays.sort(data, 0, size);
        }

        public int binarySearch(long x) {
            return Arrays.binarySearch(data, 0, size, x);
        }

        public int size() {
            return size;
        }

        public long[] toArray() {
            return Arrays.copyOf(data, size);
        }

        public String toString() {
            return Arrays.toString(toArray());
        }

        public boolean equals(Object obj) {
            if (!(obj instanceof LongArrayList)) {
                return false;
            }
            LongArrayList other = (LongArrayList) obj;
            return SequenceUtils.equal(data, 0, size - 1, other.data, 0, other.size - 1);
        }

        public int hashCode() {
            int h = 1;
            for (int i = 0; i < size; i++) {
                h = h * 31 + Long.hashCode(data[i]);
            }
            return h;
        }

        public LongArrayList clone() {
            LongArrayList ans = new LongArrayList();
            ans.addAll(this);
            return ans;
        }

    }

    static interface IntToIntegerFunction {
        int apply(int x);

    }

    static class SequenceUtils {
        public static void swap(int[] data, int i, int j) {
            int tmp = data[i];
            data[i] = data[j];
            data[j] = tmp;
        }

        public static boolean equal(long[] a, int al, int ar, long[] b, int bl, int br) {
            if ((ar - al) != (br - bl)) {
                return false;
            }
            for (int i = al, j = bl; i <= ar; i++, j++) {
                if (a[i] != b[j]) {
                    return false;
                }
            }
            return true;
        }

    }

    static class Modular {
        int m;

        public int getMod() {
            return m;
        }

        public Modular(int m) {
            this.m = m;
        }

        public Modular(long m) {
            this.m = (int) m;
            if (this.m != m) {
                throw new IllegalArgumentException();
            }
        }

        public Modular(double m) {
            this.m = (int) m;
            if (this.m != m) {
                throw new IllegalArgumentException();
            }
        }

        public int valueOf(int x) {
            x %= m;
            if (x < 0) {
                x += m;
            }
            return x;
        }

        public int valueOf(long x) {
            x %= m;
            if (x < 0) {
                x += m;
            }
            return (int) x;
        }

        public int mul(int x, int y) {
            return valueOf((long) x * y);
        }

        public int plus(int x, int y) {
            return valueOf(x + y);
        }

        public String toString() {
            return "mod " + m;
        }

    }

    static class IntExtGCDObject {
        private int[] xy = new int[2];

        public int extgcd(int a, int b) {
            return ExtGCD.extGCD(a, b, xy);
        }

        public int getX() {
            return xy[0];
        }

    }

    static class Power implements InverseNumber {
        static IntExtGCDObject extGCD = new IntExtGCDObject();
        final Modular modular;

        public Power(Modular modular) {
            this.modular = modular;
        }

        public int inverse(int x) {
            int ans = inverseExtGCD(x);
//        if(modular.mul(ans, x) != 1){
//            throw new IllegalStateException();
//        }
            return ans;
        }

        public int inverseExtGCD(int x) {
            if (extGCD.extgcd(x, modular.getMod()) != 1) {
                throw new IllegalArgumentException();
            }
            return modular.valueOf(extGCD.getX());
        }

    }

    static class Hasher {
        private long time = System.nanoTime() + System.currentTimeMillis() * 31L;

        public int shuffle(long z) {
            z += time;
            z = (z ^ (z >>> 33)) * 0x62a9d9ed799705f5L;
            return (int) (((z ^ (z >>> 28)) * 0xcb24d0a5c88c35b3L) >>> 32);
        }

        public int hash(long x) {
            return shuffle(x);
        }

    }

    static class PartialHash {
        HashData hd;
        int[] hash;

        public PartialHash(HashData hd) {
            this.hd = hd;
            hash = new int[hd.pow.length];
        }

        public void populate(IntToIntegerFunction function, int l, int r) {
            if (l > r) {
                return;
            }
            if (l > 0) {
                hash[l - 1] = 0;
            }
            hash[l] = hd.mod.mul(function.apply(l), hd.pow[l]);
            for (int i = l + 1; i <= r; i++) {
                hash[i] = hd.mod.valueOf(hash[i - 1] + hd.pow[i] * (long) function.apply(i));
            }
        }

        public int hash(int l, int r, boolean verbose) {
            if (l > r) {
                return verbose ? hd.pow[0] : 0;
            }
            long h = hash[r];
            if (l > 0) {
                h -= hash[l - 1];
                h *= hd.inv[l];
            }
            if (verbose) {
                h += hd.pow[r - l + 1];
            }
            return hd.mod.valueOf(h);
        }

    }

    static class HashData {
        public Modular mod;
        public int[] inv;
        public int[] pow;

        public HashData(int n, int p, int x) {
            this.mod = new Modular(p);
            n = Math.max(n, 1);
            inv = new int[n + 1];
            pow = new int[n + 1];
            inv[0] = 1;
            pow[0] = 1;
            int invX = new Power(mod).inverse(x);
            for (int i = 1; i <= n; i++) {
                inv[i] = mod.mul(inv[i - 1], invX);
                pow[i] = mod.mul(pow[i - 1], x);
            }
        }

        public HashData(int n) {
            this(n, (int) 1e9 + 7, RandomWrapper.INSTANCE.nextInt(1, (int) 1e9 + 6));
        }

        public int hash(long x) {
            long high = x >>> 32;
            long low = x & ((1L << 32) - 1);
            return mod.valueOf(high * pow[1] + low);
        }

    }
}

