#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <set>
#include <map>
#include <queue>

using namespace std;

typedef long long ll;
typedef long double ld;
#define fastInp cin.tie(0); cout.tie(0); ios_base::sync_with_stdio(0);

vector<vector<ll>> gr;

const ll INF = 1e9 * 1e9;
ll d[200][200], par[200][200];
bool used[200];
vector<ll> vals;
ll ans = INF;

void check(int v, int st, bool fl = 0) {
	used[v] = 1;
	ll curD = d[st][v];

	if (v != st) {
		vals[curD] = max(vals[curD], ll(gr[v].size() - 1));
	}
	else {
		if (!fl) {
			vals[curD] = max(vals[curD], ll(gr[v].size()));
		}
		else {
			vals[curD] = max(vals[curD], ll(gr[v].size() - 1));
		}
	}

	for (auto to : gr[v]) {
		if (!used[to]) {
			check(to, st, fl);
		}
	}
}

vector<ll> sv;
void check2(int v, int st) {
	vector<vector<ll>> cur;

	used[v] = 1;
	ll curD = d[st][v];

	if (st != v) vals[curD] = max(vals[curD], ll(gr[v].size()));


	for (auto to : gr[v]) {
		if (!used[to]) {
			check2(to, st);
		}
		if (v == st) {
			cur.push_back(vals);
			for (auto &cur : vals) cur = 0;
		}
	}

	for (int i = 0; i < cur.size(); i++) {
		vector<ll> c(vals.size());
		for (int t = 0; t < cur.size(); t++) {
			if (t != i) {
				for (int j = 0; j < vals.size(); j++) c[j] = max(c[j], cur[t][j]);
			}
			else {
				for (int j = 1; j < vals.size(); j++) {
					c[j - 1] = max(c[j - 1], cur[t][j]);
				}
			}
		}

		ll cr = 1;
		c[0] = max(c[0], ll(gr[st].size()));
		for (int i = 0; i < vals.size(); i++) {
			if (c[i] != 0) c[i]--;
		}
		
		for (int i = 0; i < vals.size() - 1; i++) {
			if (c[i] != 0) cr *= c[i];
		}

		ans = min(ans, cr * 2);
	}
}

int main()
{
	fastInp;

	ll n;
	cin >> n;

	gr.resize(n);
	for (int i = 0; i < n - 1; i++) {
		ll u, v;
		cin >> u >> v;
		u--; v--;
		gr[u].push_back(v);
		gr[v].push_back(u);
	}

	ll dim = 0;
	for (int i = 0; i < n; i++) {
		for (int j = 0; j < n; j++) used[j] = 0;
		queue<ll> q;
		q.push(i);
		while (!q.empty()) {
			ll v = q.front();
			q.pop();
			used[v] = 1;
			for (auto to : gr[v]) {
				if (!used[to]) {
					d[i][to] = d[i][v] + 1;
					par[i][to] = v;
					used[to] = 1;
					q.push(to);
				}
			}
		}
		for (int j = 0; j < n; j++) dim = max(dim, d[i][j]);
	}

	vals.resize(dim + 1);

	for (int i = 0; i < n; i++) {
		for (int j = 0; j < n; j++) {
			if (d[i][j] == dim) {
				vals.clear();
				vals.resize(dim + 1);
				for (int t = 0; t < n; t++) used[t] = 0;
				ll v = j;
				if (dim % 2 != 0) {
					ll ds = (dim - 1) / 2 + 1;
					while (d[i][v] != ds) {
						v = par[i][v];
					}
					ll u = par[i][v];
					used[u] = 1;
					used[v] = 1;
					check(u, u, 1);
					check(v, v, 1);
				}
				else {
					while (d[i][v] != dim / 2) {
						v = par[i][v];
					}
					check(v, v);
				}

				ll cur = 1;

				for (int i = 0; i < vals.size() - 1; i++) {
					if (vals[i] != 0) cur *= vals[i];
				}
				if (dim % 2 != 0) cur *= 2;
				ans = min(ans, cur);

				if (dim % 2 == 0) {
					sv.clear();
					sv.resize(dim + 1);
					for (int i = 0; i < vals.size(); i++) vals[i] = 0;
					for (int i = 0; i < n; i++) used[i] = 0;
					check2(v, v);
				}
			}
		}
	}

	cout << (dim) / 2 + 1 << " " << ans;
	return 0;
}

Measured memory_bytes: 3956