#include<bits/stdc++.h>
#define N 310
using namespace std;
vector<int> r[N];
int n,f[N],q[N],t,fa[N],sz[N],MX[N];
void dfs(int x){
	++f[x];sz[x]=0;
	for(int i=0,_E_=r[x].size();i<_E_;++i){
		int y=r[x][i];if(y==fa[x])continue;
		fa[y]=x;f[y]=f[x];++sz[x];dfs(y);
	}
}
void find(int nn){
	fa[1]=0;f[1]=0;dfs(1);
	int mx=0;
	for(int i=1;i<=nn;++i)if(f[i]>f[mx])mx=i;
	f[mx]=0;fa[mx]=0;dfs(mx);
	for(int i=1;i<=nn;++i)if(f[i]>f[mx])mx=i;
	t=0;for(;mx;mx=fa[mx])q[++t]=mx;
}
long long calc1(int nn){
	for(int i=1;i<=nn;++i)MX[i]=1;
	long long ans=1;
	int x=q[t+1>>1];
	fa[x]=0;f[x]=0;dfs(x);
	for(int i=1;i<=nn;++i)MX[f[i]]=max(MX[f[i]],sz[i]);
	for(int i=1;i<=nn;++i)ans*=MX[i];
	return ans;
}
long long calc2(int nn){
	for(int i=1;i<=nn;++i)MX[i]=1;
	int x=q[t>>1],y=q[t+2>>1];
	fa[x]=y;fa[y]=x;f[x]=f[y]=0;dfs(x);dfs(y);
	for(int i=1;i<=nn;++i)MX[f[i]]=max(MX[f[i]],sz[i]);
	long long ans=2;
	for(int i=1;i<=nn;++i)ans*=MX[i];
	return ans;
}
int main(){
	scanf("%d",&n);
	for(int i=1;i<=n;++i)MX[i]=1;
	for(int i=1;i<n;++i){
		int x,y;scanf("%d %d",&x,&y);
		r[x].push_back(y);r[y].push_back(x);
	}
	find(n);int TT=t+1>>1;
	long long ans;
	if(t&1){
		ans=calc1(n);
		for(int i=1;i<=n;++i){
			int T=n,ls=i;
			for(;++T;){
				r[ls].push_back(T);
				r[T].push_back(ls);
				ls=T;
				find(T);if((t+1>>1)>TT)break;
				ans=min(ans,(t&1)?calc1(T):calc2(T));
			}
			for(;T>n+1;--T)r[T].pop_back(),r[T-1].pop_back();
			r[T].pop_back();r[i].pop_back();
		}
	}else{
		ans=calc2(n);
	}
	printf("%d %lld",TT,ans);
}