#include <bits/stdc++.h>

using namespace std;

typedef long long ll;
typedef pair<ll, ll> P;

#define each(i,a) for (auto&& i : a)
#define FOR(i,a,b) for (ll i=(a),__last_##i=(b);i<__last_##i;i++)
#define RFOR(i,a,b) for (ll i=(b)-1,__last_##i=(a);i>=__last_##i;i--)
#define REP(i,n) FOR(i,0,n)
#define RREP(i,n) RFOR(i,0,n)
#define __GET_MACRO3(_1, _2, _3, NAME, ...) NAME
#define rep(...) __GET_MACRO3(__VA_ARGS__, FOR, REP)(__VA_ARGS__)
#define rrep(...) __GET_MACRO3(__VA_ARGS__, RFOR, RREP)(__VA_ARGS__)
#define pb push_back
#define all(a) (a).begin(),(a).end()
#define chmin(x,v) x = min(x, v)
#define chmax(x,v) x = max(x, v)

const ll linf = 1e18;
const double eps = 1e-12;
const double pi = acos(-1);

template<typename T>
istream& operator>>(istream& is, vector<T>& vec) {
    each(x,vec) is >> x;
    return is;
}
template<typename T>
ostream& operator<<(ostream& os, const vector<T>& vec) {
    rep(i,vec.size()) {
        if (i) os << " ";
        os << vec[i];
    }
    return os;
}
template<typename T>
ostream& operator<<(ostream& os, const vector< vector<T> >& vec) {
    rep(i,vec.size()) {
        if (i) os << endl;
        os << vec[i];
    }
    return os;
}

vector<ll> bfs(const vector<vector<ll>>& G, const ll s) {
    const ll n = G.size();
    vector<ll> dist(n, linf);
    queue<ll> Q;
    dist[s] = 0;
    Q.push(s);
    while ( !Q.empty() ) {
        ll v = Q.front(); Q.pop();
        each(to, G[v]) {
            if (dist[v]+1 < dist[to]) {
                dist[to] = dist[v]+1;
                Q.push(to);
            }
        }
    }
    return dist;
}
vector<ll> get_diameter(const vector<vector<ll>>& G) {
    const ll n = G.size();
    vector<ll> d1 = bfs(G, 0);
    ll v1 = max_element(all(d1)) - d1.begin();
    vector<ll> d2 = bfs(G, v1);
    ll v = max_element(all(d2)) - d2.begin();
    vector<ll> res{v};
    while (v != v1) {
        each(to, G[v]) {
            if (d2[to] == d2[v]-1) {
                v = to;
                break;
            }
        }
        res.pb(v);
    }
    return res;
}
ll solve(const vector<vector<ll>>& G, vector<ll> roots, set<ll> pv, const ll C) {
    ll ans = roots.size();
    // cout << roots << endl;
    rep(t, C-1) {
        vector<ll> nroots;
        ll d = 1;
        each(r, roots) {
            ll cnt = 0;
            each(to, G[r]) {
                if (pv.count(to) > 0) continue;
                nroots.pb(to);
                ++cnt;
            }
            chmax(d, cnt);
        }
        pv = set<ll>(all(roots));
        roots = nroots;
        ans *= d;
    }
    // cout << roots << " : " << ans << endl;
    return ans;
}
int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    ll n; cin >> n;
    vector<vector<ll>> G(n);
    rep(i, n-1) {
        ll a, b; cin >> a >> b; --a, --b;
        G[a].pb(b);
        G[b].pb(a);
    }
    vector<ll> dia = get_diameter(G);
    // cout << dia << endl;
    ll D = dia.size();
    ll C = (D+1)/2;
    ll ans;
    if (D % 2 == 0) {
        ans = min({
            solve(G, {dia[D/2], dia[D/2-1]}, {dia[D/2], dia[D/2-1]}, C),
        });
    }
    else {
        assert(D >= 3);
        ans = solve(G, {dia[D/2]}, {}, D);
        each(to, G[dia[D/2]]) {
            chmin(ans, solve(G, {dia[D/2], to}, {dia[D/2], to}, C));
        }
    }
    cout << C << " " << ans << endl;
}


Measured memory_bytes: 384