#define _USE_MATH_DEFINES
#include <bits/stdc++.h>
#include<iostream>
#include<unordered_set>

using namespace std;

#define dprint(Exp,...) if(Exp){fprintf(stderr, __VA_ARGS__);}
#define printe(...) fprintf(stderr, __VA_ARGS__);
#define PrtExp(_Exp)  cerr<< #_Exp <<" = "<< (_Exp)
#define PrtExpN(_Exp)  cerr<< #_Exp <<" = "<< (_Exp) <<"\n"

#define SINT(n) scanf("%d",&n)
#define SINT2(n,m) scanf("%d %d",&n,&m)
#define SINT3(n,m,o) scanf("%d %d %d",&n,&m,&o)
#define SINT4(n,m,o,P) scanf("%d %d %d %d",&n,&m,&o,&P)
#define SINT5(n,m,o,P,q) scanf("%d %d %d %d %d",&n,&m,&o,&P,&q)
#define SLL(n) scanf("%lld",&n)
#define SLL2(n,m) scanf("%lld %lld",&n,&m)
#define SLL3(n,m,o) scanf("%lld %lld %lld",&n,&m,&o)
#define SST(s) scanf("%s",s)
#define SCH(c) scanf("%c",&c)

#define GC() getchar()

#define PINT(n) printf("%d",(int)(n))
#define PINT2(n,m) printf("%d %d",(int)(n),(int)(m))
#define PINT3(n,m,l) printf("%d %d %d",(int)(n),(int)(m),(int)(l))
#define PLL(n) printf("%lld",(long long)(n))
#define PST(s) printf("%s",(s))
#define PCH(s) printf("%c",(s))

#define PINTN(n) printf("%d\n",(int)(n))
#define PINT2N(n,m) printf("%d %d\n",(int)(n),(int)(m))
#define PINT3N(n,m,l) printf("%d %d %d\n",(int)(n),(int)(m),(int)(l))
#define PLLN(n) printf("%lld\n",(long long)(n))
#define PSTN(s) printf("%s\n",(s))
#define PCHN(s) printf("%c\n",(s))

#define PSP() printf(" ")
#define PN() printf("\n")

#define PC(c) putchar(c)
#define CSP (' ')
#define SN ("\n")

#define rep(i,a) for(int i=0;i<a;i++)
#define reP(i,a) for(int i=0;i<=a;i++)
#define Rep(i,a) for(int i=a-1;i>=0;i--)
#define ReP(i,a) for(int i=a;i>=0;i--)

#define rEp(i,a) for(i=0;i<a;i++)
#define rEP(i,a) for(i=0;i<=a;i++)
#define REp(i,a) for(i=a-1;i>=0;i--)
#define REP(i,a) for(i=a;i>=0;i--)

#define repft(i,a,b) for(int i=a;i<b;i++)
#define repfT(i,a,b) for(int i=a;i<=b;i++)
#define Repft(i,a,b) for(int i=a-1;i>=b;i--)
#define RepfT(i,a,b) for(int i=a;i>=b;i--)

#define foreach(a,it) for(auto it = a.begin(); it != a.end(); ++it)

#define FILL(a,v) fill(begin(a),end(a), v)
#define FILL0(a) memset(a,0,sizeof(a))
#define FILL1(a) memset(a,-1,sizeof(a))

typedef long long ll;

typedef unsigned long long ull;
typedef pair<int, int> Pi;
typedef pair<ll, ll>   Pll;


const int INF = 1010000000; // 0x3C33'6080
const ll INFLL = 0x1f1f1f1f1f1f1f1fLL;//2,242,545,357,980,376,863

template <class A, class B> inline ostream& operator<<(ostream& st, const pair<A, B>& P) { return st << "(" << P.first << "," << P.second << ")"; };
template <class A, class B> inline pair<A, B> operator+(const pair<A, B>& P, const pair<A, B>& Q) { return pair<A, B>(P.first + Q.first, P.second + Q.second); };
template <class A, class B> inline pair<A, B> operator-(const pair<A, B>& P, const pair<A, B>& Q) { return pair<A, B>(P.first - Q.first, P.second - Q.second); };

#define fs  first
#define sc  second


// 根付き木のハッシュ値を計算する。
// tree[i] = {j1, j2, ..} :  頂点iの子は頂点j1,j2,..である
// n :  根のインデックス
using vv = vector<vector<int>> ;
map<vector<int>, int> hshs;
int treeHash(vv tree, int n = 0) {
	vector<int> ht;
	for (auto t : tree[n]) ht.push_back(treeHash(tree, t));
	sort(ht.begin(), ht.end());
	return (hshs.count(ht) ? hshs[ht] : hshs[ht] = hshs.size());
}

vector<int> G[128];

int D[128];

void dfs(int i, int d, int p) {
	int n = 0;
	for (int x : G[i]) {
		if (x == p) continue;
		++n;
	}
	D[d] = max(D[d], n);
	for (int x : G[i]) {
		if (x == p) continue;
		dfs(x, d + 1, i);
	}
}

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

	ll reta = INFLL;
	ll retb = INFLL;

	rep(i, n) {
		FILL0(D);
		dfs(i, 0, -1);
		int d = 0;
		ll v = 1;
		rep(i, 127)if (D[i] != 0) {
			d = i + 1;
			v *= D[i];
		}
		++d;
		// cout << i+1 << "   : " << d << "   : ";
		// rep(i, d) cout << D[i] << " "; cout << endl;
		if (reta > d) {
			reta = d;
			retb = v;
		} else if (reta == d) {
			retb = min(retb, v);
		}
	}

	rep(i, n) {
		for (int j : G[i]) {  
			FILL0(D);
			dfs(i, 0, j);
			dfs(j, 0, i);
			int d = 0;
			ll v = 2;
			rep(i, 127)if (D[i] != 0) {
				d = i + 1;
				v *= D[i];
			}
			++d;
			// cout << i+1 <<" "<< j+1 << " : " << d << "   : ";
			// rep(i, d) cout <<D[i] << " "; cout << endl;


			if (reta > d) {
				reta = d;
				retb = v;
			} else if (reta == d) {
				retb = min(retb, v);
			}
		}
	}
	cout << reta << " " << retb << endl;


}



Measured memory_bytes: 256