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.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.ArrayList;
import java.util.Comparator;

public class d {
    static BufferedReader s = new BufferedReader(new InputStreamReader(System.in));
    // static Scanner s=new Scanner(System.in);
    public static void main(String[] args) throws IOException {
        StringBuilder sb = new StringBuilder();
        String[] s1 = s();
        int t=i(s1[0]);
        ArrayList<Integer>[] adj=new ArrayList[t+1];
       for(int i=0;i<t-1;i++){
            String[] s2=s();
            int u=i(s2[0]);int v=i(s2[1]);
            if(adj[u]==null) adj[u]=new ArrayList<>();
            if(adj[v]==null) adj[v]=new ArrayList<>();
            adj[u].add(v);adj[v].add(u);
        }int[] vis=new int[t+1];
        int[] degree=new int[t+1];
       dfs(1,adj,degree,vis);vis=new int[t+1];ans=t-1;leaf=0;
       dfs1(1,adj,degree,vis);flag=0;vis=new int[t+1];
       dfs2(leaf,adj,degree,vis,0);
       if(flag==0) {
           System.out.print(1+" "+ans);
       }else
           System.out.println(3+" "+ans);
   //     System.out.println(sb.toString());
     }static int ans;static int leaf;static int flag=0;
     static void dfs2(int i,ArrayList<Integer>[] adj,int[] degree,int[] vis,int v){
         if(degree[i]==1&&v%2!=0){
             flag=1;return ;
         }vis[i]=1;
     //    System.out.println(i);
         for(int j:adj[i]){
             if(vis[j]==0){
                 dfs2(j,adj,degree,vis,v+1);
             }
         }
     }
     static void dfs1(int i,ArrayList<Integer>[] adj,int[] degree,int[] vis){
        vis[i]=1;
        int count=0;
        for(int j:adj[i]){
          //  System.out.println(i+" "+j+" "+degree[j]);
            if(degree[j]==1){
                count++;leaf=j;
            }
        }if(count>0) ans-=(count-1);
        for(int j:adj[i]){
            if(vis[j]==0){
                dfs1(j,adj,degree,vis);
            }
        }
     }
     static void dfs(int i,ArrayList<Integer>[] adj,int[] degree,int[] vis){
        vis[i]=1;
        if(i!=1){
            degree[i]++;
        }
        for(int j:adj[i]){
            if(vis[j]==0){
                degree[i]++;
                dfs(j,adj,degree,vis);
            }
        }
     }
    static long gcd(long a, long b) {
        if (b == 0)
            return a;
        return gcd(b, a % b);
    }
    static String[] s() throws IOException {

        return s.readLine().trim().split("\\s+");
    }

    static int i(String ss) {
        return Integer.parseInt(ss);
    }
    static long l(String ss) {
        return Long.parseLong(ss);
    }
}

class Student12 {
    int  l;long r;
    public Student12(int l, long r) {
        this.l = l;
        this.r = r;
    }

    public String toString()
    {
        return this.l+" ";
    }
}
class Sortbyroll12 implements Comparator<Student12> {

    public int compare(Student12 a, Student12 b){
        return (int)b.r-(int) a.r;
//        return (int) a.l-(int) b.l;
     /*   if(a.r<b.r) return -1;
        else if(a.r==b.r){
            if(a.r==b.r){
                return 0;
            }
            if(a.r<b.r) return -1;
            return 1;}
        return 1;  */}
}