#include<iostream>
#include<cstdio>
#include<vector>
#define FOR(i,a,b) for(int i=a;i<=b;i++)
using namespace std;
typedef long long ll;
const int N=200200;
int n,u,v,x,y,len,fa[N],f[N],g[N],h[N],d[N];
ll ans=9e18;
vector<int>ve[N];
void add(int u,int v){ve[u].push_back(v);}
void dfs1(int u){
	f[u]=0;
	for(int v:ve[u])if(v!=fa[u])
		fa[v]=u,dfs1(v),f[u]=max(f[u],f[v]+1);
}
void upd(int L){
	ll pro=1;
	FOR(i,0,L-1) pro*=h[i],h[i]=0;
	ans=min(ans,pro);
}
void dfs2(int u){
	//cout<<u<<' '<<(int)ve[u].size()-(fa[u]>0)<<'\n';
	h[d[u]]=max(h[d[u]],(int)ve[u].size()-(fa[u]>0));
	for(int v:ve[u])if(v!=fa[u])
		fa[v]=u,d[v]=d[u]+1,dfs2(v);
}
void work(int x,int y){
	fa[x]=y;fa[y]=x;d[x]=d[y]=1;h[0]=2;
	dfs2(x);dfs2(y);upd(g[x]);
	//FOR(i,0,g[x]-1) cout<<h[i]<<' ';cout<<'\n';
}
int main(){
	//freopen("1.in","r",stdin);
	//freopen("1.out","w",stdout);
	scanf("%d",&n);
	FOR(i,2,n) scanf("%d%d",&u,&v),add(u,v),add(v,u);
	FOR(i,1,n) fa[i]=0,dfs1(i),g[i]=f[i];
	x=1;
	FOR(i,2,n){
		if(g[x]>g[i]) x=i,y=0;
		else if(g[x]==g[i]) y=i;
	}
	if(!y){
		fa[x]=d[x]=0;
		dfs2(x);upd(g[x]);len=g[x]+1;
		for(int v:ve[x]) work(v,x);
	}
	else work(x,y),len=g[x];
	cout<<len<<' '<<ans<<'\n';
}