You have unweighted tree of n vertices. You have to assign a positive weight to each edge so that the following condition would hold:

  * For every two different leaves v_{1} and v_{2} of this tree, [bitwise XOR](https://en.wikipedia.org/wiki/Bitwise_operation#XOR) of weights of all edges on the simple path between v_{1} and v_{2} has to be equal to 0. 



Note that you can put very large positive integers (like 10^{(10^{10})}).

It's guaranteed that such assignment always exists under given constraints. Now let's define f as the number of distinct weights in assignment.

<image> In this example, assignment is valid, because bitwise XOR of all edge weights between every pair of leaves is 0. f value is 2 here, because there are 2 distinct edge weights(4 and 5).

<image> In this example, assignment is invalid, because bitwise XOR of all edge weights between vertex 1 and vertex 6 (3, 4, 5, 4) is not 0. 

What are the minimum and the maximum possible values of f for the given tree? Find and print both.

Input

The first line contains integer n (3 ≤ n ≤ 10^{5}) — the number of vertices in given tree.

The i-th of the next n-1 lines contains two integers a_{i} and b_{i} (1 ≤ a_{i} < b_{i} ≤ n) — it means there is an edge between a_{i} and b_{i}. It is guaranteed that given graph forms tree of n vertices.

Output

Print two integers — the minimum and maximum possible value of f can be made from valid assignment of given tree. Note that it's always possible to make an assignment under given constraints.

Examples

Input


6
1 3
2 3
3 4
4 5
5 6


Output


1 4


Input


6
1 3
2 3
3 4
4 5
4 6


Output


3 3


Input


7
1 2
2 7
3 4
4 7
5 6
6 7


Output


1 6

Note

In the first example, possible assignments for each minimum and maximum are described in picture below. Of course, there are multiple possible assignments for each minimum and maximum. 

<image>

In the second example, possible assignments for each minimum and maximum are described in picture below. The f value of valid assignment of this tree is always 3. 

<image>

In the third example, possible assignments for each minimum and maximum are described in picture below. Of course, there are multiple possible assignments for each minimum and maximum. 

<image>
import java.io.*;
import java.util.*;

public class Solution {
    public static boolean dfs(int head, int ct, List<Integer>[] edges, boolean[] vis) {
        ct += 1;
        vis[head] = true;
        boolean isLeaf = true;
        for(int next : edges[head]) {
            if(vis[next]) continue;
            if(!dfs(next, ct, edges, vis)) return false;
            isLeaf = false;
        }
        return !(isLeaf && ct % 2 == 0);
    }

    public static int dfs2(int head, int ct, int len, boolean isHead, List<Integer>[] edges, boolean[] vis) {
        vis[head] = true;
        boolean isLeaf = edges[head].size() == 1;
        boolean isNode = edges[head].size() >= 3;
        if(isNode || isHead) {
            int val = 0;
            boolean flag = false;
            for(int next : edges[head]) {
                if(vis[next]) continue;
                int nval = dfs2(next, ct + 1, 1, false, edges, vis);
                if(nval == 1) flag = true;
                else val += nval;
            }
            if(isNode) val += len;
            if(flag) val += 1;
//            System.out.println("1:" + head + " " + val);
            return val;
        } else if(isLeaf) {
            int val = 0;
            if(len >= 2 && ct > 3) val = len;
            else if(len == 1 && ct > 3) val = 1;
            else if(len >= 2 && ct == 3) val = 1;
//            System.out.println("2:" + head + " " + val);
            return val;
        } else {
            int nval = 0;
            for(int next : edges[head]) {
                if(vis[next]) continue;
                nval = dfs2(next, ct + 1, len + 1, false, edges, vis);
            }
//            System.out.println("3:" + head + " " + nval);
            return nval;
        }
    }

    public static void main(String[] args) throws IOException {
        Reader rd = new Reader();
        int n = rd.nextInt();
        List<Integer>[] edges = new List[n];
        for(int i = 0; i < n; i++) edges[i] = new ArrayList<>();
        for(int i = 0; i < n - 1; i++) {
            int a = rd.nextInt() - 1, b = rd.nextInt() - 1;
            edges[a].add(b); edges[b].add(a);
        }

        int head = -1;
        for(int i = 0; i < n; i++) {
            if(edges[i].size() == 1) {
                head = i;
                break;
            }
        }

        boolean[] vis = new boolean[n];
        Arrays.fill(vis, false);
        boolean flag1 = dfs(head, 0, edges, vis);
        int minc = flag1 ? 1 : 3;

        Arrays.fill(vis, false);
        int maxc = dfs2(head, 1, 0, true, edges, vis);

        System.out.println(minc + " " + maxc);
    }

    //Fast IO class
    static class Reader {
        final private int BUFFER_SIZE = 1 << 16;
        private DataInputStream din;
        private byte[] buffer;
        private int bufferPointer, bytesRead;

        public Reader() {
            din = new DataInputStream(System.in);
            buffer = new byte[BUFFER_SIZE];
            bufferPointer = bytesRead = 0;
        }

        public Reader(String file_name) throws IOException {
            din = new DataInputStream(new FileInputStream(file_name));
            buffer = new byte[BUFFER_SIZE];
            bufferPointer = bytesRead = 0;
        }

        public String readLine() throws IOException {
            byte[] buf = new byte[64]; // line length
            int cnt = 0, c;
            while ((c = read()) != -1) {
                if (c == '\n')
                    break;
                buf[cnt++] = (byte) c;
            }
            return new String(buf, 0, cnt);
        }

        public int nextInt() throws IOException {
            int ret = 0;
            byte c = read();
            while (c <= ' ')
                c = read();
            boolean neg = (c == '-');
            if (neg)
                c = read();
            do {
                ret = ret * 10 + c - '0';
            } while ((c = read()) >= '0' && c <= '9');

            if (neg)
                return -ret;
            return ret;
        }

        public long nextLong() throws IOException {
            long ret = 0;
            byte c = read();
            while (c <= ' ')
                c = read();
            boolean neg = (c == '-');
            if (neg)
                c = read();
            do {
                ret = ret * 10 + c - '0';
            } while ((c = read()) >= '0' && c <= '9');
            if (neg)
                return -ret;
            return ret;
        }

        public double nextDouble() throws IOException {
            double ret = 0, div = 1;
            byte c = read();
            while (c <= ' ')
                c = read();
            boolean neg = (c == '-');
            if (neg)
                c = read();

            do {
                ret = ret * 10 + c - '0';
            } while ((c = read()) >= '0' && c <= '9');

            if (c == '.') {
                while ((c = read()) >= '0' && c <= '9') {
                    ret += (c - '0') / (div *= 10);
                }
            }

            if (neg)
                return -ret;
            return ret;
        }

        private void fillBuffer() throws IOException {
            bytesRead = din.read(buffer, bufferPointer = 0, BUFFER_SIZE);
            if (bytesRead == -1)
                buffer[0] = -1;
        }

        private byte read() throws IOException {
            if (bufferPointer == bytesRead)
                fillBuffer();
            return buffer[bufferPointer++];
        }

        public void close() throws IOException {
            if (din == null)
                return;
            din.close();
        }
    }

    private static void sort(double[] arr) {
        Double[] objArr = Arrays.stream(arr).boxed().toArray(Double[]::new);
        Arrays.sort(objArr);
        for (int i = 0; i < arr.length; i++) {
            arr[i] = objArr[i];
        }
    }

    private static void sort(int[] arr) {
        Integer[] objArr = Arrays.stream(arr).boxed().toArray(Integer[]::new);
        Arrays.sort(objArr);
        for (int i = 0; i < arr.length; i++) {
            arr[i] = objArr[i];
        }
    }

    private static void sort(long[] arr) {
        Long[] objArr = Arrays.stream(arr).boxed().toArray(Long[]::new);
        Arrays.sort(objArr);
        for (int i = 0; i < arr.length; i++) {
            arr[i] = objArr[i];
        }
    }
}