#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0; i<(n); i++)
using P = pair<int, int>;
const int MX = 105;
int n, v, w, dep[MX], par[MX], ans_d;
long long ans = 1e15;
vector<int> G[MX];
long long bfs_2(int s1, int s2){
	long long ret = 1 + (s1 != s2);
	int ch = 1, de = 0;
	queue<int> qu;
	fill(dep, dep+n, -1);
	dep[s1] = dep[s2] = 0;
	qu.push(s1);
	if(s1 != s2) qu.push(s2);
	while(!qu.empty()){
		int t = qu.front(); qu.pop();
		if(dep[t] != de){
			ret *= ch;
			de++;
			ch = 1;
		}
		ch = max(ch, (int)G[t].size()-(s1 != t || s2 != t));
		for(int nx: G[t]) if(dep[nx] == -1){
			dep[nx] = dep[t] + 1;
			qu.push(nx);
		}
	}
	return ret;
}
void bfs(){
	int s = 0, t = 0;
	rep(i,2){
		queue<int> qu;
		fill(dep, dep+n, -1);
		dep[s] = 0;
		qu.push(s);
		while(!qu.empty()){
			t = qu.front(); qu.pop();
			for(int nx: G[t]) if(dep[nx] == -1){
				dep[nx] = dep[t] + 1;
				par[nx] = t;
				qu.push(nx);
			}
		}
		s = t;
	}
	ans_d = dep[t]/2+1;
	rep(i,ans_d-1) s = par[s];
	if(dep[t]&1){
		ans = bfs_2(s,par[s]);
	}else{
		ans = bfs_2(s,s);
		for(int s2: G[s]) ans = min(ans,bfs_2(s,s2));
	}
	printf("%d %lld\n", ans_d, ans);
}
int main(){
	scanf("%d", &n);
	rep(i,n-1){
		scanf("%d%d", &v, &w); v--; w--;
		G[v].push_back(w);
		G[w].push_back(v);
	}
	bfs();
}