#include <string>
#include <vector>
#include <algorithm>
#include <numeric>
#include <set>
#include <map>
#include <queue>
#include <iostream>
#include <sstream>
#include <cstdio>
#include <cmath>
#include <ctime>
#include <cstring>
#include <cctype>
#include <cassert>
#include <limits>
#include <functional>
#include <iomanip>
#include <complex>
#include <bitset>

using namespace std;

#define rep(i,n) for(int (i)=0;(i)<(int)(n);++(i))
#define rer(i,l,u) for(int (i)=(int)(l);(i)<=(int)(u);++(i))
#define reu(i,l,u) for(int (i)=(int)(l);(i)<(int)(u);++(i))
#if defined(_MSC_VER) || __cplusplus > 199711L
#define aut(r,v) auto r = (v)
#else
#define aut(r,v) __typeof(v) r = (v)
#endif
#define each(it,o) for(aut(it, (o).begin()); it != (o).end(); ++ it)
#define all(o) (o).begin(), (o).end()
#define pb(x) push_back(x)
#define mp(x,y) make_pair((x),(y))
#define mset(m,v) memset(m,v,sizeof(m))
#define INF 0x3f3f3f3f3f3f3f3fLL
#define SIZE 8080
#define REP(i,n) for(int i=0;i<(int)n;++i)
#define FOR(i,c) for(__typeof((c).begin())i=(c).begin();i!=(c).end();++i)
#define ALL(c) (c).begin(), (c).end()

typedef vector<int> vi; typedef pair<int, int> pii; typedef vector<pair<int, int> > vpii; typedef long long ll;
typedef pair<int,ll> pill; typedef pair<ll,int> plli; 
typedef pair<double, int> pdi;
template<typename T, typename U> inline void amin(T &x, U y) { if(y < x) x = y; }
template<typename T, typename U> inline void amax(T &x, U y) { if(x < y) x = y; }
typedef complex<double> P;
ll MOD=1e9+7;
typedef ll Weight;
struct Edge {
	int src, dst;
	Weight weight;
};
bool operator < (const Edge &e, const Edge &f) {
	return e.weight != f.weight ? e.weight > f.weight : // !!INVERSE!!
	e.src != f.src ? e.src < f.src : e.dst < f.dst;
}
typedef vector<Edge> Edges;
typedef vector<Edges> Graph;

int N,M;
vi Gr[105];
int far;
int dep[105]={0};
int dep2[105]={0};
void dfs(int now,int depth){
	for(int i=0;i<Gr[now].size();i++){
		int ne=Gr[now][i];
		if(dep[ne]==0){
			dep[ne]=depth+1;
			dfs(ne,depth+1);
		}
	}
}
void dfs2(int now,int depth){
	for(int i=0;i<Gr[now].size();i++){
		int ne=Gr[now][i];
		if(dep2[ne]==0){
			dep2[ne]=depth+1;
			dfs2(ne,depth+1);
		}
	}
}

ll jisu[105]={0};
void dfs3(int now,int depth){
	int cnt=0;
	for(int i=0;i<Gr[now].size();i++){
		int ne=Gr[now][i];
		if(dep2[ne]==0){
			cnt++;
		}
	}
	jisu[depth]=max(jisu[depth],(ll)cnt);
	for(int i=0;i<Gr[now].size();i++){
		int ne=Gr[now][i];
		if(dep2[ne]==0){
			dep2[ne]=depth+1;
			dfs3(ne,depth+1);
		}
	}
}
ll solve_ev(int ce){
	rep(i,N)dep2[i]=0;
	dep2[ce]=-1;
	rep(i,N)jisu[i]=0;
	dfs3(ce,0);
	ll ans=1;
	for(int i=0;i<N;i++){
		if(jisu[i]!=0)ans=ans*jisu[i];
	}
	return ans;
}
ll solve_odd(int a,int b){
	rep(i,N)dep2[i]=0;
	dep2[a]=-1;
	dep2[b]=-1;
	rep(i,N)jisu[i]=0;
	dfs3(a,0);
	dfs3(b,0);
	ll ans=2;
	for(int i=0;i<N;i++){
		if(jisu[i]!=0)ans=ans*jisu[i];
	}
	return ans;
}

int main(){
	cin>>N;
	for(int i=0;i<N-1;i++){
		int u,v;
		cin>>u>>v;u--;v--;
		
		Gr[u].pb(v);
		Gr[v].pb(u);
	}

	dep[0]=-1;
	dfs(0,0);
	int ma=0,lefp=0;
	for(int i=0;i<N;i++){
		if(dep[i]>ma){
			ma=dep[i];
			lefp=i;
		}
	}
	//木の直径;
	rep(i,N)dep[i]=0;
	dep[lefp]=-1;
	dfs(lefp,0);
	int rip=0;
	ma = 0;
	for(int i=0;i<N;i++){
		if(dep[i]>ma){
			ma=dep[i];
			rip=i;
		}
	}
	cout<<ma/2 + 1<<" ";
	//cout<<endl;
	//cout<<lefp+1<<" "<<rip+1<<endl;
	rep(i,N)dep2[i]=0;
	dep2[rip]=-1;
	dfs2(rip,0);
	//rep(i,cent.size())cout<<cent[i]<<" ";
	//cout<<endl;
	if(ma%2==0){
		int ce;
		for(int i=0;i<N;i++){
			if(dep2[i]==ma/2&&dep[i]==ma/2)ce=i;
		}
		//cout<<ce<<endl;
		ll ans=solve_ev(ce);
		for(int j=0;j<Gr[ce].size();j++){
			ans=min(ans,solve_odd(ce,Gr[ce][j]));
		}
		cout<<ans<<endl;
	}else if(ma==1){
		cout<<2<<endl;
	}else{
		vi cent;
		for(int i=0;i<N;i++){
			if(dep2[i]==ma/2&&dep[i]==ma/2+1)cent.pb(i);
			if(dep[i]==ma/2&&dep2[i]==ma/2+1)cent.pb(i);
		}
		int a=cent[0],b=cent[1];
		//cout<<cent.size()<<endl;
		/*for(int i=0;i<N;i++){
			cout<<i+1<<" "<<jisu[i]<<endl;
		}*/
		cout<<solve_odd(a,b)<<endl;
	}
}

Measured memory_bytes: 256