#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <string>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <iomanip>
#include <utility>
#include <tuple>
#include <functional>
#include <bitset>
#include <cassert>
#include <complex>
#include <stdio.h>
#include <time.h>
#include <numeric>
#include <random>
#include <unordered_map>
#include <unordered_set>
#define all(a) a.begin(),a.end()
#define rep(i, n) for (ll i = 0; i < (n); i++)
#define pb push_back
#define debug(x) cerr << #x << ':' << x << '\n'
#pragma GCC optimize("O3")
#pragma GCC optimize("unroll-loops")
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
typedef pair<ll, ll> P;
typedef complex<ld> com;
constexpr int inf = 1000000010;
constexpr ll INF = 1000000000000000010;
constexpr ld eps = 1e-12;
constexpr ld pi = 3.141592653589793238;
template<class T, class U> inline bool chmax(T &a, const U &b) { if (a < b) { a = b; return true; } return false; }
template<class T, class U> inline bool chmin(T &a, const U &b) { if (a > b) { a = b; return true; } return false; }

int N = 110;
vector<vector<int>> graph(N, vector<int>());

void dfs(int n, int p, int d, vector<int> &dis) {
	dis[n] = d;
	for (int i : graph[n]) {
		if (i == p) continue;
		dfs(i, n, d + 1, dis);
	}
}

int main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	cout << fixed << setprecision(20);

	int n;
	cin >> n;
	vector<int> deg(n, -1);
	rep(i, n - 1) {
		int u, v;
		cin >> u >> v;
		u--; v--;
		graph[u].pb(v);
		graph[v].pb(u);
		deg[u]++; deg[v]++;
	}
	vector<int> xd(n), yd(n);
	dfs(0, -1, 0, xd);
	int ver; int tmp = -1;
	rep(i, n) if (chmax(tmp, xd[i])) ver = i;
	dfs(ver, -1, 0, xd);
	int rver; tmp = -1;
	rep(i, n) if (chmax(tmp, xd[i])) rver = i;
	dfs(rver, -1, 0, yd);
	int diam = xd[rver];
	if (diam & 1) {
		int cen, cen2;
		rep(i, n) {
			if (xd[i] == diam / 2 && yd[i] == diam / 2 + 1) cen = i;
			if (xd[i] == diam / 2 + 1 && yd[i] == diam / 2) cen2 = i;
		}
		queue<int> que;
		vector<int> dis(n);
		dfs(cen, cen2, 0, dis);
		dfs(cen2, cen, 0, dis);
		vector<int> val(n, 1);
		que.push(cen); que.push(cen2);
		while (!que.empty()) {
			int v = que.front(); que.pop();
			chmax(val[dis[v]], deg[v]);
			for (int i : graph[v]) {
				if (dis[i] <= dis[v]) continue;
				que.push(i);
			}
		}
		ll ans = 2;
		for (int i : val) ans *= i;
		cout << diam / 2 + 1 << ' ' << ans << '\n';
	}
	else {
		int cen;
		rep(i, n) if (xd[i] == diam / 2 && yd[i] == diam / 2) cen = i;
		ll ans = INF;
		{
			queue<int> que;
			vector<int> dis(n);
			dfs(cen, -1, 0, dis);
			vector<int> val(n, 1);
			que.push(cen);
			while (!que.empty()) {
				int v = que.front(); que.pop();
				chmax(val[dis[v]], deg[v]);
				for (int i : graph[v]) {
					if (dis[i] <= dis[v]) continue;
					que.push(i);
				}
			}
			val[0]++;
			ll res = 1;
			for (int i : val) res *= i;
			chmin(ans, res);
		}
		for (int cen2 : graph[cen]) {
			queue<int> que;
			vector<int> dis(n);
			dfs(cen, cen2, 0, dis);
			dfs(cen2, cen, 0, dis);
			vector<int> val(n, 1);
			que.push(cen); que.push(cen2);
			while (!que.empty()) {
				int v = que.front(); que.pop();
				chmax(val[dis[v]], deg[v]);
				for (int i : graph[v]) {
					if (dis[i] <= dis[v]) continue;
					que.push(i);
				}
			}
			ll res = 2;
			for (int i : val) res *= i;
			chmin(ans, res);
		}
		cout << diam / 2 + 1 << ' ' << ans << '\n';
	}
}

Measured memory_bytes: 3636