import Control.Applicative
import Data.List
import Data.Maybe
import Data.Ord
import qualified Data.Map as M
import qualified Data.Set as S

import Debug.Trace

type NodeMap = M.Map Int (S.Set Int)

-- pairのリストを整理する
-- [[x, y],...] 
normalize_pair :: [[Int]] -> [(Int, Int)]
normalize_pair [] = []
normalize_pair ([x,y]:rest) = (x, y):(y,x):(normalize_pair rest)

-- pairのリストを第1要素でソート
sort_pair :: [(Int, Int)] -> [(Int, Int)]
sort_pair l = sortBy (comparing fst) l

-- createTree' はsortされたpairのリストをもらって木を作る前段階の
-- 以下のようなリストに変換します
-- [(x1, y11), (x1, y12),...,  (x2, y21), (x2, y22),...]
-- → [(x1, [y11, y12,...]), (x2, [y21, y22,...]), ...]
createTree' :: [(Int, Int)] -> [(Int, [Int])]
createTree' [] = []
createTree' ((x,y):rest) = ct' x [y] rest 
    where
        ct' x y_list [] = [(x, y_list)]
        ct' x y_list ((x', y'):rest)
            | x == x'   = ct' x (y':y_list) rest
            | otherwise = (x, y_list):(ct' x' [y'] rest)

-- [(x1, [y11, y12,...]),]の形のリストをもらって
-- x1から集合{y1, y2,..}へのマップを作成します
convertTree :: [(Int, [Int])] -> NodeMap
convertTree l = M.fromList $ map (\(x, yl)->(x, S.fromList yl)) l

-- 木はノード番号からつながっているノード番号の集合へのマップで表す
createTree :: [[Int]] -> NodeMap
createTree = convertTree . createTree' . sort_pair . normalize_pair

-- 木から葉のみ残したマップを求める
leafOf :: M.Map Int (S.Set Int) -> NodeMap
leafOf tree = M.filter (\s->(S.size s) == 1) tree

-- マップから隣接したノードのうち自身に含まないインデックスの集合を求める
nextNodeOf :: NodeMap -> S.Set Int
nextNodeOf map = S.filter ((flip M.notMember) map) $ S.unions $ M.elems map

-- 集合から条件を満たす要素を数える
countIf :: (a->Bool) -> S.Set a -> Int
countIf pred set = S.foldl f 0 set
    where
        f count x = if pred x then count + 1 else count

-- 親を指定してxの子を求める
child :: NodeMap -> Int -> Int -> [Int]
child tree parent x = filter (parent /=) $ S.elems (tree M.! x)

-- 与えられたノードから最も遠いノード(の一つ)とそのノードまでの距離を求める
farthest :: NodeMap -> Int -> (Int, Int)
farthest tree x = farthest' (-1) x
    where
        farthest' exclude x =
            case child tree exclude x of
                [] -> (x, 0)
                next_nodes -> (node, distance+1)
                    where
                        (node, distance) = maximumBy (comparing snd) $ map (farthest' x) next_nodes

-- 木の直径を求める
-- もっとも遠い点の組とその距離を返す
diameter :: NodeMap -> (Int, Int, Int)
diameter tree = (x, y, d)
    where
        (x, _) = farthest tree 1
        (y, d) = farthest tree x

findMaybe :: (a -> Maybe b) -> [a] -> Maybe b
findMaybe f [] = Nothing
findMaybe f (head:rest) = maybe (findMaybe f rest) Just (f head)

-- ある点から指定の距離だけ離れた点を求める
findAtDistance :: NodeMap -> Int -> Int -> Maybe Int
findAtDistance tree distance point = findAtDistance' distance (-1) point
    where
        findAtDistance' 0 _ p = Just p
        findAtDistance' d exclude p = 
            case child tree exclude p of
                [] -> Nothing
                next_nodes -> findMaybe (findAtDistance' (d - 1) p) next_nodes

-- 木の中心と中心からの高さを求める
center :: NodeMap -> ([Int], Int)
center tree = case diameter tree of
    (x, y, d) -> (map (fromJust . (findAtDistance tree r)) c, r)
        where
            c = if d `mod` 2 == 0 then [x] else [x, y]
            r = d `div` 2

categorizeWith :: Ord b => (a -> b) -> [a] -> [(b, [a])]
categorizeWith f l = categorizeWith' $ sortBy (comparing f) l 
    where
        categorizeWith' [] = []
        categorizeWith' (x:rest) = cw (f x) [x] rest
        cw f_x l [] = [(f_x, l)]
        cw f_x l (x':r')
                | f_x == f_x' = cw f_x (x':l) r'
                | otherwise   = (f_x, l):(cw f_x' [x'] r')
            where
                f_x' = f x'


radiusNodeListFrom :: NodeMap -> Int -> Int -> Int -> [(Int, Int)]
radiusNodeListFrom tree r parent x = (r, x):rest
    where
        rest = foldl (++) [] $ map (radiusNodeListFrom tree (r+1) x) $ child tree parent x

categorizeByRadius :: NodeMap -> [Int] -> [(Int, [Int])]
categorizeByRadius tree centers = map (\(c, v)->(c, map snd v)) $ categorizeWith fst $ concatMap rf px
    where
        rf (parent, x) = radiusNodeListFrom tree 0 parent x
        px = case centers of
            [x]    -> [(-1, x)]
            [x, y] -> [(x, y), (y, x)]

countLeaf :: NodeMap -> [Int] -> Int
countLeaf tree centers = factor * (foldr (*) 1 $ map max_childs nodes_list)
    where
        factor = case centers of
            [x] -> 1
            _   -> 2
        max_childs (h, l) = maximum $ map f l
            where
                f x' = case S.size (tree M.! x') of
                    1 -> 1
                    n -> if (h == 0) && (factor == 1) then n else n - 1 -- 中心が1つのときだけ特別
        nodes_list = categorizeByRadius tree centers

main :: IO ()
main = do
    n <- readLn
    pairs <- mapM (\_ -> map read . words <$> getLine) [1..n-1] :: IO [[Int]]
    let
        tree = createTree pairs
        (centers, r) = center tree
    let
        leaf_count = minimum $ map (countLeaf tree) centers_list
            where
                centers_list = case centers of
                    [x] -> [x] : (map ((flip (:)) [x]) (S.elems (tree M.! x)))
                    _   -> [centers]
    putStrLn $ (show (r + 1)) ++ " " ++ (show leaf_count)
