use std::cmp;
use std::collections::VecDeque;

fn main() {
    let (r, w) = (std::io::stdin(), std::io::stdout());
    let mut sc = IO::new(r.lock(), w.lock());
    let n: usize = sc.read();
    let mut graph = vec![vec![]; n];
    for _ in 1..n {
        let x = sc.read::<usize>() - 1;
        let y = sc.read::<usize>() - 1;
        graph[x].push(y);
        graph[y].push(x);
    }

    let mut ans = (n, n);
    for i in 0..n {
        let dist = get_dist(i, i, &graph);
        let (max, leaves) = calc(i, i, dist, &graph);
        if ans > (max, leaves) {
            ans = (max, leaves);
        }
    }

    for i in 0..n {
        for &next in graph[i].iter() {
            let dist = get_dist(i, next, &graph);
            let (max, leaves) = calc(i, next, dist, &graph);
            if ans > (max, leaves) {
                ans = (max, leaves);
            }
        }
    }

    println!("{} {}", ans.0, ans.1);
}

fn calc(c0: usize, c1: usize, dist: Vec<usize>, graph: &Vec<Vec<usize>>) -> (usize, usize) {
    let n = dist.len();
    let max = *dist.iter().max().unwrap();
    let mut max_d = vec![0; max + 1];
    for i in 0..n {
        let d = graph[i].len();
        max_d[dist[i]] = cmp::max(max_d[dist[i]], d - 1);
        if dist[i] == 1 && c0 == c1 {
            max_d[dist[i]] = cmp::max(max_d[dist[i]], d);
        }
    }

    let mut leaves = if c0 == c1 { 1 } else { 2 };
    for color in 1..max {
        leaves *= max_d[color];
    }
    (max, leaves)
}

fn get_dist(c0: usize, c1: usize, graph: &Vec<Vec<usize>>) -> Vec<usize> {
    let n = graph.len();
    if c0 == c1 {
        let mut dist = vec![n; n];
        dist[c0] = 1;
        let mut q = VecDeque::new();
        q.push_back(c0);
        while let Some(v) = q.pop_front() {
            for &next in graph[v].iter() {
                if dist[next] > dist[v] + 1 {
                    dist[next] = dist[v] + 1;
                    q.push_back(next);
                }
            }
        }
        dist
    } else {
        let mut dist = vec![n; n];
        dist[c0] = 1;
        dist[c1] = 1;
        let mut q = VecDeque::new();
        q.push_back(c0);
        q.push_back(c1);
        while let Some(v) = q.pop_front() {
            for &next in graph[v].iter() {
                if dist[next] > dist[v] + 1 {
                    dist[next] = dist[v] + 1;
                    q.push_back(next);
                }
            }
        }
        dist
    }
}
pub struct IO<R, W: std::io::Write>(R, std::io::BufWriter<W>);

impl<R: std::io::Read, W: std::io::Write> IO<R, W> {
    pub fn new(r: R, w: W) -> IO<R, W> {
        IO(r, std::io::BufWriter::new(w))
    }
    pub fn write<S: ToString>(&mut self, s: S) {
        use std::io::Write;
        self.1.write(s.to_string().as_bytes()).unwrap();
    }
    pub fn read<T: std::str::FromStr>(&mut self) -> T {
        use std::io::Read;
        let buf = self
            .0
            .by_ref()
            .bytes()
            .map(|b| b.unwrap())
            .skip_while(|&b| b == b' ' || b == b'\n' || b == b'\r' || b == b'\t')
            .take_while(|&b| b != b' ' && b != b'\n' && b != b'\r' && b != b'\t')
            .collect::<Vec<_>>();
        unsafe { std::str::from_utf8_unchecked(&buf) }
            .parse()
            .ok()
            .expect("Parse error.")
    }
    pub fn vec<T: std::str::FromStr>(&mut self, n: usize) -> Vec<T> {
        (0..n).map(|_| self.read()).collect()
    }
    pub fn chars(&mut self) -> Vec<char> {
        self.read::<String>().chars().collect()
    }
}


Measured memory_bytes: 4352