#include<bits/stdc++.h>
#define st first
#define nd second
#define pb push_back
#define ppb pop_back
#define ii pair<int,int>
#define ll long long
#define umin(x,y) x=min(x,y)
#define umax(x,y) x=max(x,y)
#define orta ((bas+son)>>1)
#define sz(x) ((int)x.size())
#define all(x) x.begin(),x.end()
#define inf 1000000000000000
#define N 505
#define MOD 998244353
using namespace std;

int n;
int mx[N];
vector<pair<int,ii>> deep;
vector<int> v[N];

void dfs2(int node,int ata,int h) {

	int cnt=0;

	for(auto x:v[node]) {

		if(x==ata) continue; 

		++cnt;

		dfs2(x,node,h+1);		

	}

	umax(mx[h+1],cnt);

}

int dfs(int node,int ata) {

	int res=0;

	for(auto x:v[node]) {

		if(x==ata) continue ;

		umax(res,dfs(x,node)+1);

	}

	return res;

}

ll solve(int a,int b) {

	for(int i=1;i<=n;i++) mx[i]=0;

	dfs2(a,b,0);
	dfs2(b,a,0);
	
	ll res=1;

	for(int i=1;mx[i];i++) res*=mx[i];

	return res;

}

int main() {

	scanf("%d",&n);

	for(int i=1;i<n;i++) {

		int x,y;

		scanf("%d %d",&x,&y);

		v[x].pb(y);
		v[y].pb(x);

	}

	for(int i=1;i<=n;i++) {

		deep.pb({dfs(i,0),{i,i}});;

		for(auto x:v[i]) {

			deep.pb({max(dfs(i,x),dfs(x,i)),{i,x}});

		}

	}

	sort(deep.begin(),deep.end());

	ll leaf=inf;

	for(int i=0;i<sz(deep);i++) {

		if(i && deep[i].st!=deep[i-1].st) break ;

		umin(leaf,(ll) (1+(deep[i].nd.st!=deep[i].nd.nd))*solve(deep[i].nd.st,deep[i].nd.nd));

	}

	printf("%d %lld",deep[0].st+1,leaf);

}