#include <algorithm>
#include <iostream>
#include <vector>
#include <math.h>
#include <set>
#include <map>
#include <string>
#include <stack>
#include <queue>
#include <iomanip>
#include <numeric>
#include <tuple>
#define _USE_MATH_DEFINES
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> plglg;
typedef tuple<int, int, int> tiii;
typedef tuple<ll, ll, ll> tlglglg;
int dx[4] = {1, 0, -1, 0};
int dy[4] = {0, 1, 0, -1};
double pi = 3.141592653589793;
ll mod = 1000000007;
int intmax = 2147483647;
int intmin = -2147483648;
ll llmax = 9223372036854775807;
ll llmin = -9223372036854775807;

struct edge {
    int to, cost;
};

int V;
vector<edge> G[110];
ll d[110];
vector<int> diam;

plglg visit(int v) {
    plglg ans(0, v);
    queue<tlglglg> que;
    tlglglg start(-1, v, 0);
    d[v] = 0;
    que.push(start);
    while (que.size() > 0) {
        tlglglg p;
        p = que.front();
        que.pop();
        ll back = get<0>(p);
        ll now = get<1>(p);
        ll weight = get<2>(p);
        int n = G[now].size();
        for (int i = 0; i < n; i++) {
            edge e = G[now][i];
            if (e.to != back) {
                tlglglg pp(now, e.to, weight + e.cost);
                que.push(pp);
                d[e.to] = weight + e.cost;
                if (weight + e.cost > ans.first) {
                    ans.first = weight + e.cost;
                    ans.second = e.to;
                }
            }
        }
    }
    return ans;
}

pii farthest;

ll diameter() {
    plglg r = visit(0);
    plglg t = visit(r.second);
    farthest.first = r.second;
    farthest.second = t.second;
    int now = t.second;
    diam.push_back(now);
    for (int i = 0; i < t.first; i++) {
        int s = G[now].size();
        for (int j = 0; j < s; j++) {
            if (d[G[now][j].to] == t.first - i - 1) {
                now = G[now][j].to;
                diam.push_back(now);
                break;
            }
        }
    }
    return t.first;
}

ll leafs[110];
int dis[110];
int p[110];

int main() {
    int N;
    cin >> N;
    for (int i = 0; i < N - 1; i++) {
        int a, b;
        cin >> a >> b;
        edge e1;
        e1.to = b - 1;
        e1.cost = 1;
        G[a - 1].push_back(e1);
        edge e2;
        e2.to = a - 1;
        e2.cost = 1;
        G[b - 1].push_back(e2);
    }
    ll gdiam = diameter() + 1;
    ll leaf = llmax;
    int color = intmax;
    fill(leafs, leafs + N, 0);
    fill(dis, dis + N, intmax);
    if (gdiam % 2 == 0) {
        int cena = diam[gdiam / 2 - 1];
        int cenb = diam[gdiam / 2];
        dis[cena] = 0;
        dis[cenb] = 0;
        queue<int> que;
        que.push(cena);
        que.push(cenb);
        leafs[0] = max(G[cena].size() - 1, G[cenb].size() - 1);
        while(!que.empty()) {
            int now = que.front();
            que.pop();
            if (G[now].size() - 1 > leafs[dis[now]]) {
                leafs[dis[now]] = G[now].size() - 1;
            }
            int num = G[now].size();
            for (int i = 0; i < num; i++) {
                if (dis[G[now][i].to] == intmax) {
                    dis[G[now][i].to] = dis[now] + 1;
                    que.push(G[now][i].to);
                }
            }
        }
        leaf = 2;
        for (int i = 0; i < gdiam / 2 - 1; i++) {
            leaf *= leafs[i];
        }
        color = gdiam / 2;
    } else {
        int cena = diam[gdiam / 2];
        int x = G[cena].size();
        color = gdiam / 2 + 1;
        for (int i = 0; i < x; i++) {
            fill(leafs, leafs + N, 0);
            fill(dis, dis + N, intmax);
            int cenb = G[cena][i].to;
            dis[cena] = 0;
            dis[cenb] = 0;
            queue<int> que;
            que.push(cena);
            que.push(cenb);
            leafs[0] = max(G[cena].size() - 1, G[cenb].size() - 1);
            while(!que.empty()) {
                int now = que.front();
                que.pop();
                if (G[now].size() - 1 > leafs[dis[now]]) {
                    leafs[dis[now]] = G[now].size() - 1;
                }
                int num = G[now].size();
                for (int i = 0; i < num; i++) {
                    if (dis[G[now][i].to] == intmax) {
                        dis[G[now][i].to] = dis[now] + 1;
                        que.push(G[now][i].to);
                    }
                }
            }
            ll l = 2;
            for (int i = 0; i < gdiam / 2; i++) {
                l *= leafs[i];
            }
            if (l < leaf) {
                leaf = l;
            }
        }
        fill(leafs, leafs + N, 0);
        fill(dis, dis + N, intmax);
        dis[cena] = 0;
        queue<int> que;
        que.push(cena);
        leafs[0] = G[cena].size();
        while(!que.empty()) {
            int now = que.front();
            que.pop();
            if (G[now].size() - 1 > leafs[dis[now]]) {
                leafs[dis[now]] = G[now].size() - 1;
            }
            int num = G[now].size();
            for (int i = 0; i < num; i++) {
                if (dis[G[now][i].to] == intmax) {
                    dis[G[now][i].to] = dis[now] + 1;
                    que.push(G[now][i].to);
                }
            }
        }
        ll l = 1;
        for (int i = 0; i < gdiam / 2; i++) {
            l *= leafs[i];
        }
        if (l < leaf) {
            leaf = l;
        }
    }
    cout << color << " " << leaf << endl;
}


Measured memory_bytes: 384