#include <bits/stdc++.h>
// iostream is too mainstream
#include <cstdio>
// bitch please
#include <iostream>
#include <algorithm>
#include <cstdlib>
#include <vector>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <list>
#include <cmath>
#include <iomanip>
#include <time.h>
#define dibs reserve
#define OVER9000 1234567890
#define ALL_THE(CAKE,LIE) for(auto LIE =CAKE.begin(); LIE != CAKE.end(); LIE++)
#define tisic 47
#define soclose 1e-8
#define chocolate win
// so much chocolate
#define patkan 9
#define ff first
#define ss second
#define abs(x) (((x) < 0)?-(x):(x))
#define uint unsigned int
#define dbl long double
#define pi 3.14159265358979323846
using namespace std;
// mylittledoge

using cat = long long;

#ifdef DONLINE_JUDGE
	// palindromic tree is better than splay tree!
	#define lld I64d
#endif

void DFS(int R, auto & G, auto & dep) {
	ALL_THE(G[R], it) if(dep[*it] == -1) {
		dep[*it] = dep[R] + 1;
		DFS(*it, G, dep);
	}
}

cat solve(auto & G, int col_min) {
	int N = G.size();
	int r[4];
	vector<int> dep[3];
	r[0] = 0;
	for(int k = 0; k < 3; k++) {
		dep[k].resize(N, -1);
		dep[k][r[k]] = 0;
		DFS(r[k], G, dep[k]);
		r[k+1] = -1;
		for(int i = 0; i < N; i++)
			if(r[k+1] == -1 || dep[k][i] > dep[k][r[k+1]]) r[k+1] = i;
	}
	if(col_min != dep[2][r[3]] / 2 + 1) return -1;
	int R = 0;
	for(int i = 0; i < N; i++) if(dep[2][i]+dep[1][i] == dep[2][r[3]])
		if(abs(dep[2][i]-dep[1][i]) <= 1) R = i;

	if(dep[2][r[3]]&1) {
		G.push_back(vector<int>(2));
		ALL_THE(G[R], it) if(dep[2][*it]+dep[1][*it] == dep[2][r[3]]) {
			if(abs(dep[2][*it]-dep[1][*it]) > 1) continue;
			G[N][0] = R;
			G[N][1] = *it;
			ALL_THE(G[*it], jt) if(*jt == R) {
				G[*it].erase(jt);
				break;
			}
			G[R].erase(it);
			break;
		}
		G[G[N][0]].push_back(N);
		G[G[N][1]].push_back(N);
		R = N;
		N++;
	}

	vector<int> depR(N, -1);
	depR[R] = 0;
	DFS(R, G, depR);

	vector<int> maxdeg(N+1, 0);
	for(int i = 0; i < N; i++) {
		if(i == R) maxdeg[depR[i]] = max(maxdeg[depR[i]], (int)G[i].size());
		else maxdeg[depR[i]] = max(maxdeg[depR[i]], (int)G[i].size() - 1);
	}

	unsigned long long ans = 1;
	for(int i = 0; i <= N; i++) if(maxdeg[i] > 0) {
		if(ans > ((1ULL<<63) - 1) / maxdeg[i]) return -1;
		ans *= (unsigned long long) maxdeg[i];
	}
	return ans;
}

int main() {
	cin.sync_with_stdio(0);
	cin.tie(0);
	cout << fixed << setprecision(10);
	int N;
	cin >> N;
	vector< vector<int> > G(N);
	for(int i = 0; i < N-1; i++) {
		int u, v;
		cin >> u >> v;
		G[--u].push_back(--v);
		G[v].push_back(u);
	}

	int r[4];
	vector<int> dep[3];
	r[0] = 0;
	for(int k = 0; k < 3; k++) {
		dep[k].resize(N, -1);
		dep[k][r[k]] = 0;
		DFS(r[k], G, dep[k]);
		r[k+1] = -1;
		for(int i = 0; i < N; i++)
			if(r[k+1] == -1 || dep[k][i] > dep[k][r[k+1]]) r[k+1] = i;
	}
	int col_min = dep[2][r[3]] / 2 + 1;

	auto G1 = G;
	cat min_leaves = solve(G1, col_min);
	for(int i = 0; i < N; i++) for(int k = 1; k <= N/2; k++) {
		vector< vector<int> > Gp = G;
		for(int j = 1; j <= k; j++) {
			Gp.push_back(vector<int>(1, (j >= 2) ? N+j-2 : i));
			Gp[(j >= 2) ? N+j-2 : i].push_back(N+j-1);
		}
		cat leaves = solve(Gp, col_min);
		if(min_leaves == -1) min_leaves = leaves;
		else if(leaves != -1) min_leaves = min(min_leaves, leaves);
	}
	cout << col_min << " " << min_leaves << "\n";
	return 0;}

// look at my code
// my code is amazing


Measured memory_bytes: 384