#include<cstdio>
#include<cstring>
#include<algorithm>
#include<vector>
using namespace std;
int n,mx,dis[110],dep[110],ans1,s[110];
long long ans2=0x3f3f3f3f3f3f3f3f;
vector<int>E[110];
void dfs(int v,int fa)
{
	dis[v]=1;
	int d=0;
	for(auto u:E[v])
	{
		if(u==fa)continue;
		dep[u]=dep[v]+1;
		dfs(u,v);++d;
		mx=max(mx,dis[v]+dis[u]);
		dis[v]=max(dis[v],dis[u]+1);
	}
	s[dep[v]]=max(s[dep[v]],d);
}
void calc1(int x)
{
	memset(s,0,sizeof(s));
	dep[x]=1,dfs(x,0);
	if(dis[x]!=ans1)return ;
	long long res=1;
	for(int i=1;i<ans1;++i)res*=s[i];
	ans2=min(ans2,res);
}
void calc2(int x,int y)
{
	memset(s,0,sizeof(s));
	dep[x]=1,dfs(x,y),dep[y]=1,dfs(y,x);
	if(dis[x]>ans1||dis[y]>ans1)return ;
	long long res=1;
	for(int i=1;i<ans1;++i)res*=s[i];
	ans2=min(ans2,res*2);
}
int main()
{
	scanf("%d",&n);
	int x,y;
	for(int i=1;i<n;++i)
	{
		scanf("%d %d",&x,&y);
		E[x].push_back(y),E[y].push_back(x);
	}
	dfs(1,0);
	ans1=(mx+1)/2;
	printf("%d ",ans1);
	for(int i=1;i<=n;++i)
	{
		calc1(i);
		for(auto j:E[i])if(j>i)calc2(i,j);
	}
	printf("%lld",ans2);
	return 0;
}
