Language: C++

use std::collections::VecDeque;

fn main() {
    ioset! { inp, buf }
    macro_rules! scan {
        ($($r:tt)*) => {
            input! { inp, $($r)* }
        }
    }
    macro_rules! print {
        ($($t:expr),*) => {
            write!(buf, $($t),*).unwrap();
        } 
    }

    scan! {
        N: usize,
        E: [(usize1, usize1); N - 1],
    }

    let mut g = vec![Vec::new(); N];
    for (a, b) in E.iter() {
        g[*a].push(*b);
        g[*b].push(*a);
    }
    let mut ans = (N + 1, 0);
    for s in 0..N {
        let mut que = Vec::new();
        let mut res = Vec::new();
        que.push((s, N, 0));
        while let Some((v, f, c)) = que.pop() {
            if res.len() == c {
                res.push(g[v].len() - 1);
            }
            else if res[c] < g[v].len() - 1 {
                res[c] = g[v].len() - 1;
            }
            for t in g[v].iter() {
                if f != *t {
                    que.push((*t, v, c + 1));
                }
            }
        }
        let mut leave = 1;
        res[0] += 1;
        res.pop();
        for x in res.iter()  {
            leave *= x;
        }
        ans = std::cmp::min(ans, (res.len() + 1, leave));
    }
    for (a, b) in E {
        let mut que = Vec::new();
        let mut res = Vec::new();
        que.push((a, b, 0));
        que.push((b, a, 0));
        while let Some((v, f, c)) = que.pop() {
            if res.len() == c {
                res.push(g[v].len() - 1);
            }
            else if res[c] < g[v].len() - 1 {
                res[c] = g[v].len() - 1;
            }
            for t in g[v].iter() {
                if f != *t {
                    que.push((*t, v, c + 1));
                }
            }
        }
        let mut leave = 1;
        res.pop();
        for x in res.iter()  {
            leave *= x;
        }
        ans = std::cmp::min(ans, (res.len() + 1, leave * 2));
    }
    let (a, b) = ans;
    println!("{} {}\n", a, b);
}

use std::io::{ stdout, BufWriter, Write };

#[macro_export]
macro_rules! ioset {
    ($inp:ident, $buf:ident) => {
        inset!($inp);
        outset!($buf);
    }
}

#[macro_export]
macro_rules! inset {
    (source = $s:expr, $iter:ident) => {
        let mut $iter = $s.split_whitespace();
    };
    ($iter:ident) => {
        let s = {
            use std::io::Read;
            let mut s = String::new();
            std::io::stdin().read_to_string(&mut s).unwrap();
            s
        };
        let mut $iter = s.split_whitespace();
    }
}

#[macro_export]
macro_rules! input {
    ($iter:expr) => {};
    ($iter:expr, ) => {};
    ($iter:expr, $var:ident : $t:tt, $($r:tt)*) => {
        let $var = read_value!($iter, $t);
        input! { $iter, $($r)* }
    };
    ($iter:expr, mut $var:ident : $t:tt, $($r:tt)*) => {
        let mut $var = read_value!($iter, $t);
        input! { $iter, $($r)* }
    };
    ($iter:expr, ($var:expr) : $t:tt, $($r:tt)*) => {
        $var = read_value!($iter, $t);
        input! { $iter, $($r)* }
    };
}

#[macro_export]
macro_rules! read_value {

    // tuple
    ($iter:expr, ( $($t:tt), * )) => {
        ( $(read_value!($iter, $t)), * )
    };
    
    // array
    ($iter:expr, [ $t:tt; $len:expr ]) => {
        (0..$len).map(|_| read_value!($iter, $t)).collect::<Vec<_>>()
    };
    
    // string
    ($iter:expr, chars) => {
        read_value!($iter, String).chars().collect::<Vec<char>>()
    };

    ($iter:expr, usize1) => {
        $iter.next().unwrap().parse::<usize>().expect("Parse error") - 1
    };
    
    // any other
    ($iter:expr, $t:ty) => {
        $iter.next().unwrap().parse::<$t>().expect("Parse error")
    };
}

#[macro_export]
macro_rules! outset {
    ($buf:ident) => {
        let sout = stdout();
        let mut $buf = BufWriter::new(sout.lock());
    }
}

#[macro_export]
macro_rules! output {
    ($buf:expr, $($t:expr),*) => {
        write!($buf, $($t),*).unwrap();
    }
}

struct Chars<'a>(&'a Vec<char>);

impl<'a> std::fmt::Display for Chars<'a> {
    fn fmt(&self, f: &mut std::fmt::Formatter) -> Result<(), std::fmt::Error> {
        write!(f, "{}", self.0.iter().collect::<String>())
    }
}


Compiler output:
a.cc:27:14: error: too many decimal points in number
   27 |     for s in 0..N {
      |              ^~~~
a.cc:83:2: error: invalid preprocessing directive #[
   83 | #[macro_export]
      |  ^
a.cc:91:2: error: invalid preprocessing directive #[
   91 | #[macro_export]
      |  ^
a.cc:107:2: error: invalid preprocessing directive #[
  107 | #[macro_export]
      |  ^
a.cc:125:2: error: invalid preprocessing directive #[
  125 | #[macro_export]
      |  ^
a.cc:135:10: error: too many decimal points in number
  135 |         (0..$len).map(|_| read_value!($iter, $t)).collect::<Vec<_>>()
      |          ^~~~~~~
a.cc:153:2: error: invalid preprocessing directive #[
  153 | #[macro_export]
      |  ^
a.cc:161:2: error: invalid preprocessing directive #[
  161 | #[macro_export]
      |  ^
a.cc:168:14: warning: multi-character character constant [-Wmultichar]
  168 | struct Chars<'a>(&'a Vec<char>);
      |              ^~~~~~~
a.cc:170:6: warning: multi-character literal with 31 characters exceeds 'int' size of 4 bytes
  170 | impl<'a> std::fmt::Display for Chars<'a> {
      |      ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
a.cc:172:29: error: too many decimal points in number
  172 |         write!(f, "{}", self.0.iter().collect::<String>())
      |                             ^~~~~~~
a.cc:1:1: error: 'use' does not name a type
    1 | use std::collections::VecDeque;
      | ^~~
a.cc:3:1: error: 'fn' does not name a type
    3 | fn main() {
      | ^~
a.cc:81:1: error: 'use' does not name a type
   81 | use std::io::{ stdout, BufWriter, Write };
      | ^~~
a.cc:84:1: error: 'macro_rules' does not name a type
   84 | macro_rules! ioset {
      | ^~~~~~~~~~~
a.cc:92:1: error: 'macro_rules' does not name a type
   92 | macro_rules! inset {
      | ^~~~~~~~~~~
a.cc:108:1: error: 'macro_rules' does not name a type
  108 | macro_rules! input {
      | ^~~~~~~~~~~
a.cc:126:1: error: 'macro_rules' does not name a type
  126 | macro_rules! read_value {
      | ^~~~~~~~~~~
a.cc:154:1: error: 'macro_rules' does not name a type
  154 | macro_rules! outset {
      | ^~~~~~~~~~~
a.cc:162:1: error: 'macro_rules' does not name a type
  162 | macro_rules! output {
      | ^~~~~~~~~~~
a.cc:168:8: error: 'Chars' is not a class template
  168 | struct Chars<'a>(&'a Vec<char>);
      |        ^~~~~
a.cc:168:14: error: unable to find character literal operator 'operator""a' with 'int' argument
  168 | struct Chars<'a>(&'a Vec<char>);
      |              ^~~~~~~
a.cc:168:31: error: expected unqualified-id before ')' token
  168 | struct Chars<'a>(&'a Vec<char>);
      |                               ^
a.cc:170:1: error: 'impl' does not name a type
  170 | impl<'a> std::fmt::Display for Chars<'a> {
      | ^~~~