#include<bits/stdc++.h>
using namespace std;
const int N=233;
struct edge{
	int to,next;
}e[N*2];
int head[N],tot;
int mxd[N];
#define ll long long
ll ans1,ans2;
void add(int x,int y){
	e[++tot]=(edge){y,head[x]};
	head[x]=tot;
}
void dfs(int x,int fa,int d){
	int sum=0;
	for (int i=head[x];i;i=e[i].next)
		if (e[i].to!=fa){
			sum++;
			dfs(e[i].to,x,d+1);
		}
	mxd[d]=max(mxd[d],sum);
}
void solvert(int rt){
	memset(mxd,0,sizeof(mxd));
	dfs(rt,0,1);
	ll tot1=1,tot2=1;
	for (;mxd[tot1];tot1++)
		tot2=1ll*tot2*mxd[tot1];
	if (tot1<ans1||(tot1==ans1&&tot2<ans2))
		ans1=tot1,ans2=tot2;
}
void solveedge(int rt1,int rt2){
	memset(mxd,0,sizeof(mxd));
	dfs(rt1,rt2,1); dfs(rt2,rt1,1);
	ll tot1=1,tot2=2;
	for (;mxd[tot1];tot1++)
		tot2=1ll*tot2*mxd[tot1];
	if (tot1<ans1||(tot1==ans1&&tot2<ans2))
		ans1=tot1,ans2=tot2;
}
int n;
int main(){
	ans1=1e18,ans2=1e18;
	scanf("%d",&n);
	for (int i=1;i<n;i++){
		int x,y;
		scanf("%d%d",&x,&y);
		add(x,y); add(y,x);
	}
	for (int i=1;i<=n;i++){
		solvert(i);
		for (int j=head[i];j;j=e[j].next)
			solveedge(i,e[j].to);
	}
	printf("%lld %lld",ans1,ans2);
}