#include <bits/stdc++.h>

#define _overload(_1,_2,_3,name,...) name
#define _rep(i,n) _range(i,0,n)
#define _range(i,a,b) for(int i=int(a);i<int(b);++i)
#define rep(...) _overload(__VA_ARGS__,_range,_rep,)(__VA_ARGS__)

#define _rrep(i,n) _rrange(i,n,0)
#define _rrange(i,a,b) for(int i=int(a)-1;i>=int(b);--i)
#define rrep(...) _overload(__VA_ARGS__,_rrange,_rrep,)(__VA_ARGS__)

#define _all(arg) begin(arg),end(arg)
#define uniq(arg) sort(_all(arg)),(arg).erase(unique(_all(arg)),end(arg))
#define getidx(ary,key) lower_bound(_all(ary),key)-begin(ary)
#define clr(a,b) memset((a),(b),sizeof(a))
#define bit(n) (1LL<<(n))
#define popcount(n) (__builtin_popcountll(n))

using namespace std;

template<class T>bool chmax(T &a, const T &b) { return (a<b)?(a=b,1):0;}
template<class T>bool chmin(T &a, const T &b) { return (b<a)?(a=b,1):0;}

using ll=long long;
using R=long double;
const R EPS=1e-9L; // [-1000,1000]->EPS=1e-8 [-10000,10000]->EPS=1e-7
inline int sgn(const R& r){return(r > EPS)-(r < -EPS);}
inline R sq(R x){return sqrt(max(x,0.0L));}

const int dx[8]={1,0,-1,0,1,-1,-1,1};
const int dy[8]={0,1,0,-1,1,1,-1,-1};

// Problem Specific Parameter:

#define error(args...) {;} //vector<string> _debug = split(#args, ',');err(begin(_debug), args);}

vector<string> split(const string& s, char c){
	vector<string> v;stringstream ss(s);string x;
	while (getline(ss, x, c)) v.emplace_back(x);
	return move(v);
}

void err(vector<string>::iterator it) {cerr << endl;}
template<typename T, typename... Args> void err(vector<string>::iterator it, T a,Args... args){
cerr << it -> substr((*it)[0] == ' ', it -> length()) << " = " << a << " ",err(++it, args...);
}


const int limit = 110;
vector<int> tree[limit];
int par[limit];

void dfs(int v,int p,int d,vector<int> &dist){
	par[v] = p,dist[v] = d;
	for(auto &v2:tree[v]){
		if(v2 == p) continue;
		dfs(v2,v,d+1,dist);
	}
}


string tree_bucket(int v,int p){
	vector<string> cand;

	for(auto &v2:tree[v]){
		if(v2 == p) continue;
		cand.push_back(tree_bucket(v2,v));
	} 

	sort(begin(cand),end(cand));
	string ret = "(";
	for(auto &it:cand) ret += it;
		return ret + ")"; 
}

int total = 1,max_depth = 1;
int adj[10010][limit];
bool leaf[10010];
int depth[limit];

void tree_travasal(int v,int d,string& bucket,int& idx){
	if(bucket[idx] == '(') idx++;
	chmax(max_depth,d + 1);

	rep(i,limit){
		if(bucket[idx] == ')') break;

		if(adj[v][i] == -1){
			adj[v][i] = total;
			leaf[v] = false;
			leaf[total] = true;
			rep(j,limit) adj[total][j] = -1;
			total++;
		}

		chmax(depth[d+1],i+1);
		tree_travasal(adj[v][i],d+1,bucket,idx);
	}
	
	idx++;
	return;
}

const ll inf = (1LL << 63) - 1;

ll calc(int a,int b){
	error("subcalc",a,b);
	total = 1, max_depth = 1;
	rep(i,limit) adj[0][i] = -1,depth[i] = 0;
	leaf[0] = true,depth[0] = 1;

	for(auto &c:{a,b}){
		const int ab = a^b;
		string ret = tree_bucket(c,c^ab);
		error(ret);
		int idx = 0;
		tree_travasal(0,0,ret,idx);
	}

	ll ret = 2LL;
	rep(i,max_depth){
		if(ret > inf/depth[i]) 
			ret = inf;
		else
			ret *= depth[i];
	}

	return ret;
}

int main(void){
	int n;
	cin >> n;

	rep(i,n-1){
		int a,b;
		cin >> a >> b;
		a--,b--;
		tree[a].push_back(b);
		tree[b].push_back(a);
	}

	
	vector<int> udist(n,0),vdist(n,0);
	dfs(0,-1,1,udist);
	const int v = max_element(begin(udist),end(udist)) - begin(udist);

	dfs(v,-1,1,vdist);
	const int u = max_element(begin(vdist),end(vdist)) - begin(vdist);

	const int dist = vdist[u];
	const int ans1 = (dist + 1) / 2;
	ll ans2 = inf;

	deque<int> roots;
	{
		int cur = u;
		while(cur != -1){
			roots.push_back(cur);
			cur = par[cur];
		}

		while(roots.size() > 2){
			roots.pop_front();
			roots.pop_back();
		}
	}

	rep(i,10010){
		rep(j,limit) adj[i][j] = -1;
		leaf[i] = false;
	}
	leaf[0] = true, depth[0] = 1;


	if(roots.size() == 1){

		const int root = roots[0];
		error("single",root);

		for(auto &c:tree[root]){
			string ret = tree_bucket(c,root);
			int idx = 0;
			tree_travasal(0,0,ret,idx);
		}

		ll ret = tree[root].size();

		rep(i,max_depth){
			if(ret > inf/depth[i]) 
				ret = inf;
			else
				ret *= depth[i];
		}

		chmin<ll>(ans2, ret);
		for(auto &c:tree[root]) chmin<ll>(ans2,calc(c,root));
	}else{
		error("plural");
		const int a = roots[0], b = roots[1];
		chmin<ll>(ans2,calc(a,b));
	}

	cout << ans1 << " " << ans2 << endl;

	return 0;
}


Measured memory_bytes: 4736