#include<cstdio>
#include<cstring>
#include<vector>
#include<queue>
#include<set>
#include<map>
#include<cstdlib>
#include<iostream>
#include<algorithm>
#define fi first
#define se second
#define L(i,u) for (int i=head[u]; i!=0; i=nxt[i])
#define rep(i,a,b) for (register int i=a; i<=b; i++)
#define per(i,a,b) for (register int i=a; i>=b; i--)
typedef long long ll;
using namespace std;
typedef pair<ll,ll> Pii;
typedef vector<int> Vi;
inline void read(int &x) {
	x=0; char c=getchar(); int f=1;
	while (!isdigit(c)) {if (c=='-') f=-1; c=getchar();}
	while (isdigit(c)) {x=x*10+c-'0'; c=getchar();} x*=f;
}
const int N = 2333;
Pii ans; ll res=1;
int a[N],b[N],len,dis[N],A[N],B[N];
int n,head[N],to[N],nxt[N],edgenum,deg[N];
void add(int u, int v) {
	to[++edgenum]=v; nxt[edgenum]=head[u]; head[u]=edgenum;
}
void DFS(int s, int u, int fa, int Dis) {
	dis[s]=max(dis[s],Dis);
	L(i,u) if (to[i]!=fa) DFS(s,to[i],u,Dis+1);
}
void solve() {
	int mx=0; rep(i,1,len) mx=max(mx,deg[a[i]]);
	if (mx<=1) {res=1; return;}
	int Len=0;
	rep(k,1,len) L(i,a[k]) if (to[i]!=b[k]) A[++Len]=to[i],B[Len]=a[k];
	len=Len; rep(i,1,len) a[i]=A[i],b[i]=B[i]; solve(); res*=mx-1;
	//*(mx-1)
}
int main() { int x,y;
	read(n); rep(i,2,n) {read(x);read(y);add(x,y);add(y,x);deg[x]++;deg[y]++;}
	rep(i,1,n) DFS(i,i,0,1);
	ans.fi=7e18;
	rep(u,1,n) {
		len=0; L(i,u) a[++len]=to[i],b[len]=u; res=1;
		solve(); if (deg[u]==1) res++; else res*=deg[u]; ans=min(ans,Pii(dis[u],res));
	}
	rep(u,1,n) L(i,u) {
		int v=to[i];
		dis[u]=dis[v]=0; DFS(u,u,v,1); DFS(v,v,u,1);
		res=1; len=2; a[1]=u; b[1]=v; a[2]=v; b[2]=u; solve(); res*=2;
		ans=min(ans,Pii(max(dis[u],dis[v]),res));
	}
	cout<<ans.fi<<' '<<ans.se;
	return 0;
}
