#include "iostream"
#include "climits"
#include "list"
#include "queue"
#include "vector"
#include "string"
#include "map"
#include "algorithm"
#include "functional"
#include "set"
#include "numeric"

using namespace std;

const long long int MOD = 1000000007; 

long long int N, M, K, H, W, L, R;

vector<int>Center(vector<vector<int>>&edge) {
	int n = edge.size();
	vector<int>center;
	vector<int>dis(n, MOD);
	dis[0] = 0;
	queue<int>Q;
	Q.push(0);
	while (!Q.empty()) {
		int cn = Q.front();
		Q.pop();
		for (auto i : edge[cn]) {
			if (dis[i] > dis[cn] + 1) {
				dis[i] = dis[cn] + 1;
				Q.push(i);
			}
		}
	}
	int nx = 0;
	for (int i = 1; i < n; i++) {
		if (dis[i] > dis[nx])nx = i;
	}
	for (int i = 0; i < n; i++)dis[i] = MOD;
	dis[nx] = 0;
	Q.push(nx);
	while (!Q.empty()) {
		int cn = Q.front();
		Q.pop();
		for (auto i : edge[cn]) {
			if (dis[i] > dis[cn] + 1) {
				dis[i] = dis[cn] + 1;
				Q.push(i);
			}
		}
	}
	int snx = 0;
	for (int i = 1; i < n; i++) {
		if (dis[i] > dis[snx])snx = i;
	}
	vector<int>rev_dis(n, MOD);
	rev_dis[snx] = 0;
	Q.push(snx);
	while (!Q.empty()) {
		int cn = Q.front();
		Q.pop();
		for (auto i : edge[cn]) {
			if (rev_dis[i] > rev_dis[cn] + 1) {
				rev_dis[i] = rev_dis[cn] + 1;
				Q.push(i);
			}
		}
	}
	int m = dis[snx] + 1;
	m /= 2;
	M = dis[snx] / 2 + 1;
	for (int i = 0; i < n; i++) {
		if (dis[i] <= m && rev_dis[i] <= m)center.push_back(i);
	}
	return center;
}

int main() {
	ios::sync_with_stdio(false);
	cin.tie(0);

	cin >> N;
	if (N == 2) {
		cout << "1 2\n";
		return 0;
	}
	vector<vector<int>>edge(N);
	for (int i = 1; i < N; i++) {
		cin >> L >> R;
		L--;
		R--;
		edge[L].push_back(R);
		edge[R].push_back(L);
	}
	long long int ans = MOD * MOD;
	auto center = Center(edge);
	if (center.size() == 2) {
		vector<int>dis(N, MOD);
		queue<int>Q;
		for (auto i : center) {
			dis[i] = 0;
			Q.push(i);
		}
		while (!Q.empty()) {
			int cn = Q.front();
			Q.pop();
			for (auto i : edge[cn]) {
				if (dis[i] > dis[cn] + 1) {
					dis[i] = dis[cn] + 1;
					Q.push(i);
				}
			}
		}
		vector<int>m(N, 0);
		for (int i = 0; i < N; i++) {
			int num = 0;
			for (auto j : edge[i]) {
				if (dis[j] > dis[i])num++;
			}
			if (!dis[i])m[dis[i]] = max(m[dis[i]], num * 2);
			else m[dis[i]] = max(m[dis[i]], num);
		}
		long long int bag = 1;
		for (auto i : m)bag *= (!i ? 1 : i);
		ans = min(ans, bag);
	}
	else {
		for (auto loop : edge[center[0]]) {
			vector<int>dis(N, MOD);
			queue<int>Q;
			for (auto i : center) {
				dis[i] = 0;
				Q.push(i);
			}
			dis[loop] = 0;
			Q.push(loop);
			while (!Q.empty()) {
				int cn = Q.front();
				Q.pop();
				for (auto i : edge[cn]) {
					if (dis[i] > dis[cn] + 1) {
						dis[i] = dis[cn] + 1;
						Q.push(i);
					}
				}
			}
			vector<int>m(N, 0);
			for (int i = 0; i < N; i++) {
				int num = 0;
				for (auto j : edge[i]) {
					if (dis[j] > dis[i])num++;
				}
				if (!dis[i])m[dis[i]] = max(m[dis[i]], num * 2);
				else m[dis[i]] = max(m[dis[i]], num);
			}
			long long int bag = 1;
			for (auto i : m)bag *= (!i ? 1 : i);
			ans = min(ans, bag);
		}
		vector<int>dis(N, MOD);
		queue<int>Q;
		for (auto i : center) {
			dis[i] = 0;
			Q.push(i);
		}
		while (!Q.empty()) {
			int cn = Q.front();
			Q.pop();
			for (auto i : edge[cn]) {
				if (dis[i] > dis[cn] + 1) {
					dis[i] = dis[cn] + 1;
					Q.push(i);
				}
			}
		}
		vector<int>m(N, 0);
		for (int i = 0; i < N; i++) {
			int num = 0;
			for (auto j : edge[i]) {
				if (dis[j] > dis[i])num++;
			}
			m[dis[i]] = max(m[dis[i]], num);
		}
		long long int bag = 1;
		for (auto i : m)bag *= (!i ? 1 : i);
		ans = min(ans, bag);
	}
	cout << M << " " << ans << endl;
	return 0;
}

Measured memory_bytes: 256