#pragma comment(linker, "/STACK:512000000")
#include <bits/stdc++.h>
using namespace std;

#define all(a) a.begin(), a.end()
typedef long long li;
typedef long double ld;
void solve(__attribute__((unused)) bool);
void precalc();
clock_t start;
#define FILENAME ""

int main() {
#ifdef AIM
    string s = FILENAME;
//    assert(!s.empty());
    freopen("/home/alexandero/ClionProjects/cryptozoology/input.txt", "r", stdin);
#else
//    freopen(FILENAME ".in", "r", stdin);
//    freopen(FILENAME ".out", "w", stdout);
    //freopen("input.txt", "r", stdin);
    //freopen("output.txt", "w", stdout);
#endif
    start = clock();
    int t = 1;
#ifndef AIM
    cout.sync_with_stdio(0);
    cin.tie(0);
#endif
    precalc();
    cout.precision(10);
    cout << fixed;
    //cin >> t;
    int testNum = 1;
    while (t--) {
        //cout << "Case #" << testNum++ << ": ";
        solve(true);
    }
    cout.flush();
#ifdef AIM1
    while (true) {
      solve(false);
  }
#endif

#ifdef AIM
    cout.flush();
    auto end = clock();

    usleep(10000);
    print_stats(end - start);
    usleep(10000);
#endif

    return 0;
}

void precalc() {
}

template<typename T>
inline T nxt() {
    T cur;
    cin >> cur;
    return cur;
}

//#define int li
//const int mod = 1000000007;

const int INF = (int)1e9;

pair<int, li> get_res(vector<vector<int>> g, int root) {
    int n = g.size();
    vector<int> q;
    q.push_back(root);
    vector<char> used(n, false);
    used[root] = true;
    vector<int> degs;
    pair<int, li> res(0, 1);
    while (!q.empty()) {
        ++res.first;
        vector<int> new_q;
        int cur_deg = 0;
        for (int x : q) {
            cur_deg = max(cur_deg, (x == root ? (int)g[x].size() : ((int)g[x].size() - 1)));
            for (int to : g[x]) {
                if (!used[to]) {
                    new_q.push_back(to);
                    used[to] = true;
                }
            }
        }
        if (cur_deg) {
            degs.push_back(cur_deg);
        }
        q.swap(new_q);
    }
    for (int x : degs) {
        res.second = res.second * x;
    }
    return res;
}

void solve(__attribute__((unused)) bool read) {
    int n;
    cin >> n;
    vector<vector<int>> g(n);
    vector<pair<int, int>> edges;
    for (int i = 1; i < n; ++i) {
        int a, b;
        cin >> a >> b;
        --a; --b;
        g[a].push_back(b);
        g[b].push_back(a);
        edges.push_back({a, b});
    }
    pair<int, li> res(INF, 0);
    for (int i = 0; i < n; ++i) {
        res = min(res, get_res(g, i));
    }
    for (int i = 0; i < edges.size(); ++i) {
        vector<vector<int>> new_g(n + 1);
        int a = edges[i].first, b = edges[i].second;
        for (int j = 0; j < edges.size(); ++j) {
            if (j == i) {
                new_g[a].push_back(n);
                new_g[b].push_back(n);
                new_g[n].push_back(a);
                new_g[n].push_back(b);
            } else {
                new_g[edges[j].first].push_back(edges[j].second);
                new_g[edges[j].second].push_back(edges[j].first);
            }
        }
        auto cur_item = get_res(new_g, n);
        --cur_item.first;
        res = min(res, cur_item);
    }
    cout << res.first << " " << res.second << "\n";
}

Measured memory_bytes: 256