#include <bits/stdc++.h>
#define int long long
#define ll long long
using ull = unsigned long long;
using namespace std;
const int INF = 1ll << 50;
const int MOD = 1e9 + 7;
#define dump(x)                             \
    if (dbg) {                              \
        cerr << #x << " = " << (x) << endl; \
    }
#define overload4(_1, _2, _3, _4, name, ...) name
#define FOR1(n) for (ll i = 0; i < (n); ++i)
#define FOR2(i, n) for (ll i = 0; i < (n); ++i)
#define FOR3(i, a, b) for (ll i = (a); i < (b); ++i)
#define FOR4(i, a, b, c) for (ll i = (a); i < (b); i += (c))
#define FOR(...) overload4(__VA_ARGS__, FOR4, FOR3, FOR2, FOR1)(__VA_ARGS__)
#define FORR(i, a, b) for (int i = (a); i <= (b); ++i)
#define bit(n, k) ((n >> k) & 1) /*nのk bit目*/
template <class T>
bool chmin(T& a, const T& b) {
    if (a > b) {
        a = b;
        return 1;
    } else
        return 0;
}
template <class T>
bool chmax(T& a, const T& b) {
    if (a < b) {
        a = b;
        return 1;
    } else
        return 0;
}
void Yes(bool flag = true) {
    if (flag)
        cout << "Yes" << endl;
    else
        cout << "No" << endl;
}
void No(bool flag = true) {
    Yes(!flag);
}
void YES(bool flag = true) {
    if (flag)
        cout << "YES" << endl;
    else
        cout << "NO" << endl;
}
void NO(bool flag = true) {
    YES(!flag);
}
template <typename A, size_t N, typename T>
void Fill(A (&array)[N], const T& val) {
    std::fill((T*)array, (T*)(array + N), val);
}
#define pb push_back
#define mp make_pair
#define eb emplace_back
#define lb lower_bound
#define ub upper_bound
#define all(v) (v).begin(), (v).end()
#define SZ(x) ((int)(x).size())
#define vi vector<int>
//#define P pair<int, int>
//#define V vector<int>
//#define S set<int>
#define itn int
#define asn ans
bool dbg = true;

int N;
vector<vi> G;
int clr = INF, mi = INF;

itn D, r = -1;
vi path;
int center[20];

int seen[202020];


int dfs1(int idx = 0, itn par = -1, itn d = 0) {
    if (d > D) {
        D = d;
        r = idx;
    }
    for (auto& nxt : G[idx]) {
        if (nxt != par) {
            dfs1(nxt, idx, d + 1);
        }
    }
}

int dfs2(int idx, int par = -1, int d = 0) {
    path.eb(idx);
    if (d > D) {
        D = d;
        FOR(2) {
            center[i] = path[(d + i) / 2];
        }
    }
    for (auto& nxt : G[idx])
        if (nxt != par)
            dfs2(nxt, idx, d + 1);
    path.pop_back();
}

void f(int num) {
    Fill(seen, 0);
    queue<int> que1;
    int res = num;
    FOR(num) {
        que1.push(center[i]);
        seen[center[i]] = 1;
    }
    int leaf = num;
    bool flag = 1;
    while (!que1.empty()) {
        leaf = que1.size();
        queue<int> que2;
        int MAX = 0;
        while (!que1.empty()) {
            int idx = que1.front();
            //cerr << idx + 1 << endl;
            que1.pop();
            seen[idx] = 1;
            chmax(MAX, (int)G[idx].size() - 1);

            for (auto& nxt : G[idx]) {
                if (!seen[nxt]) {
                    que2.push(nxt);
                }
            }
        }
        que1 = que2;
        if (flag && num == 1) {
            MAX++;
        }
        flag = 0;
        if (MAX > 0)
            res *= MAX;
        //cerr << endl;
    }
    dump(res);
    dump(leaf);
    // cerr << endl;

    chmin(mi, res);
}

void solve() {
    dfs1();
    D = 0;
    dfs2(r);
    cerr << D << endl;

    clr = D / 2 + 1;
    if (center[0] != center[1]) {
        f(2);
    } else {
        f(1);

        for (auto idx : G[center[0]]) {
            center[1] = idx;
            f(2);
        }
    }
    cout << clr << " " << mi << endl;
}

signed main() {
    cin.tie(nullptr);
    ios::sync_with_stdio(false);

    cin >> N;
    G.resize(N);
    FOR(N - 1) {
        int a, b;
        cin >> a >> b;
        a--;
        b--;
        G[a].eb(b);
        G[b].eb(a);
    }


    solve();
    return 0;
}


Measured memory_bytes: 1792