#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for(int i = 0; i < n; i++)
#define rep2(i, x, n) for(int i = x; i <= n; i++)
#define rep3(i, x, n) for(int i = x; i >= n; i--)
#define elif else if
typedef long long ll;
typedef pair<ll, ll> P;
const ll MOD = 1e9+7;
const ll MOD2 = 998244353;
const ll INF = LLONG_MAX;
string alpha = "abcdefghijklmnopqrstuvwxyz";

int main(){
    int N;
    cin >> N;
    vector<int> edge[N+1];
    rep(i, N-1){
        int a, b;
        cin >> a >> b;
        edge[a].push_back(b);
        edge[b].push_back(a);
    }
    queue<int> qu[N+1];
    vector<int> path[N+1][N+1];
    int dept[N+1][N+1];
    bool use[N+1][N+1];
    rep2(i, 1, N+1){
        fill_n(use[i], N+1, false);
    }
    int subr = 0, r = 0, start;
    rep2(z, 1, N){
        qu[z].push(z);
        use[z][z] = true;
        dept[z][z] = 0;
        path[z][z].push_back(z);
        while(!qu[z].empty()){
            int i = qu[z].front();
            qu[z].pop();
            rep(j, edge[i].size()){
                int k = edge[i][j];
                if(!use[z][k]){
                    dept[z][k] = dept[z][i]+1;
                    use[z][k] = true;
                    qu[z].push(k);
                    path[z][k] = path[z][i];
                    path[z][k].push_back(k);
                }
            }
        }
    }
    rep2(i, 1, N){
        if(dept[1][i] >= subr) {subr = dept[1][i]; start = i;}
    }
    rep2(i, 1, N){
        if(dept[start][i] >= r) r = dept[start][i];
    }
    vector<pair<int, int> > vec;
    ll ans = INF;
    rep2(i, 1, N) rep2(j, i, N){
        if(dept[i][j] == r){
            vec.push_back(make_pair(i, j));
        }
    }
    bool alre[N+1];
    fill_n(alre, N+1, false);
    rep(z, vec.size()){
        int s = vec[z].first;
        int e = vec[z].second;
        int a[edge[path[s][e][r/2]].size()+1];
        if(r%2 == 0){
            a[0] = path[s][e][r/2];
            if(alre[a[0]]) continue;
            alre[a[0]] = true;
            rep(i, edge[a[0]].size()){
                a[i+1] = edge[a[0]][i];
            }
        }
        else{
            a[0] = path[s][e][(r-1)/2];
            a[1] = path[s][e][(r+1)/2];
        }
        int v = edge[a[0]].size();
        queue<int> que[v+1];
        int dep[v+1][N+1];
        ll chi[v+1][N+1];
        vector<int> depth[v+1][r/2+1];
        bool used[v+1][N+1];
        rep(i, v+1){
            fill_n(used[i], N+1, false);
            fill_n(chi[i], N+1, 0);
        }
        if(r%2 == 1){
            rep(i, 2){
                used[0][a[i]] = true;
                que[0].push(a[i]);
                depth[0][0].push_back(a[i]);
                dep[0][a[i]] = 0;
            }
            while(!que[0].empty()){
                int i = que[0].front();
                que[0].pop();
                rep(j, edge[i].size()){
                    int k = edge[i][j];
                    if(!used[0][k]){
                        chi[0][i]++;
                        used[0][k] = true;
                        dep[0][k] = dep[0][i]+1;
                        depth[0][dep[0][k]].push_back(k);
                        que[0].push(k);
                    }
                }
            }
        }
        if(r%2 == 0){
            used[0][a[0]] = true;
            que[0].push(a[0]);
            depth[0][0].push_back(a[0]);
            dep[0][a[0]] = 0;
            while(!que[0].empty()){
                int i = que[0].front();
                que[0].pop();
                rep(j, edge[i].size()){
                    int k = edge[i][j];
                    if(!used[0][k]){
                        chi[0][i]++;
                        used[0][k] = true;
                        dep[0][k] = dep[0][i]+1;
                        depth[0][dep[0][k]].push_back(k);
                        que[0].push(k);
                    }
                }
            }
            rep2(p, 1, v){
                rep(q, 2){
                    used[p][a[p*q]] = true;
                    que[p].push(a[p*q]);
                    depth[p][0].push_back(a[p*q]);
                    dep[p][a[p*q]] = 0;
                }
                while(!que[p].empty()){
                    int i = que[p].front();
                    que[p].pop();
                    rep(j, edge[i].size()){
                        int k = edge[i][j];
                        if(!used[p][k]){
                            chi[p][i]++;
                            used[p][k] = true;
                            dep[p][k] = dep[p][i]+1;
                            depth[p][dep[p][k]].push_back(k);
                            que[p].push(k);
                        }
                    }
                }
            }
        }
        int n;
        if(r%2 == 0) n = v+1;
        else n = 1;
        rep(p, n){
            ll tmp = 1;
            if(p != 0 || n == 1) tmp *= 2;
            rep(i, r/2){
                ll M = 1;
                rep(j, depth[p][i].size()){
                    int k = depth[p][i][j];
                    M = max(M, chi[p][k]);
                }
                if(tmp > INF/M) break;
                tmp *= M;
            }
            ans = min(ans, tmp);
        }
    }
  	cout << r/2 + 1 << ' ' << ans << endl;
}

Measured memory_bytes: 3328