#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const int N=200005;
int read(){
	int f=1,g=0;
	char ch=getchar();
	for (;!isdigit(ch);ch=getchar()) if (ch=='-') f=-1;
	for (;isdigit(ch);ch=getchar()) g=g*10+ch-'0';
	return f*g;
}
int n,d,b[N],depth[N],deg[N],fa[N];
ll ans;
vector<int> e[N];
void chkmax(int &x,int y){if (x<y) x=y;}
void work(int x,int fath){
	fa[x]=fath;deg[x]=0;
	for (auto y : e[x])
	if (y!=fath){
		deg[x]++;depth[y]=depth[x]+1;
		work(y,x);
	}
}
void calc(int x,int y){
	depth[x]=depth[y]=0;
	work(x,y);work(y,x);
	for (int i=0;i<=d;i++) b[i]=0;
	for (int i=1;i<=n;i++) chkmax(b[depth[i]],deg[i]);
	ll t=(x==y) ? 1 : 2;
	for (int i=0;i<d;i++) t*=b[i];
	ans=min(ans,t);
}
int main(){
	n=read();
	ans=0x7fffffffffffffffll;
	for(int i=1;i<n;i++){
		int u=read(),v=read();
		e[u].push_back(v);
		e[v].push_back(u);
	}
	int x=1;depth[x]=0;
	work(x,0);
	for (int i=1;i<=n;i++) if (depth[i]>depth[x]) x=i;
	depth[x]=0;
	work(x,0);
	for (int i=1;i<=n;i++) if (depth[i]>depth[x]) x=i;
	d=depth[x]/2;
	for (int i=1;i<=d;i++) x=fa[x];
	if (depth[x]!=d) calc(x,fa[x]);
	else{
		calc(x,x);
		for (auto y : e[x]) calc(x,y);
	}
	printf("%d %lld\n",d+1,ans);
	return 0;
}