#include <bits/stdc++.h>
#define mp make_pair
#define X first
#define Y second
#define pii pair<ll,ll>
#define x1 dlfjl
#define x2 dkfj
#define x3 dflgkg
#define MOD 1000000007
#define y1 dskgj
#define y2 dskfj
#define y3 dfhgdh
#define SQ 320
#define PI 3.14159265359
typedef long long ll;
using namespace std;
ll n,i,j,k,x,y,z,m,q,h,r,timer,mx,l,sum, ans;
ll a[150][150];
pii  b[200500];
vector<ll> g[100500], f, ff[150];
void dfs(ll v, ll lvl, ll p = -1) {
    sum = max(sum, lvl);
    for (int i = 0; i < g[v].size(); i++) {
        ll to = g[v][i];
        if (to != p) {
            dfs(to, lvl+1, v);
        }
    }
}

void dfs2(ll v, ll lvl, ll p = -1) {
    ll cnt = 0;
    for (int i = 0; i < g[v].size(); i++) {
        ll to = g[v][i];
        if (to != p) {
            cnt++;
            dfs2(to, lvl+1, v);
        }
    }
    ff[lvl].push_back(cnt);
}
int main() {
    //freopen("input.txt","r",stdin);
    cin >> n;
    for (int i = 0; i < n-1; i++) {
        cin >> x >> y;
        g[x].push_back(y);
        g[y].push_back(x);
    }
    ll min1 = MOD;
    for (int i = 1; i <= n; i++) {
        sum = 0;
        dfs(i, 0);
        if (sum < min1) {
            min1 = sum;
            f.clear();
            f.push_back(i);
        } else if (sum == min1) {
            f.push_back(i);
        }
    }

    if (f.size() > 1) {
        cout << min1 << " ";
        for (int i = 0; i < f.size(); i++) {
            for (int j = 0; j <= min1; j++)
                ff[j].clear();
            dfs2(f[i], 0, f[1-i]);
            for (int j = 0; j <= min1; j++) {
                sort(ff[j].begin(), ff[j].end());
                reverse(ff[j].begin(), ff[j].end());
                for (int k = 0; k < ff[j].size(); k++)
                    a[j][k] = max(a[j][k], ff[j][k]);
            }
        }
        ll ans = 1;
        for (int j = 0; j <= min1; j++) {
            if (a[j][0] != 0)
                ans *= a[j][0];
        }
        cout << ans*2 << endl;
    } else {
        ll ans = MOD;
        cout << min1+1 << " ";
        ll v = f[0];
        for (int it = 0; it < g[v].size(); it++) {
            for (int j = 0; j <= min1; j++) {
                for (int k = 0; k <= 110; k++)
                    a[j][k] = 0;
            }

            ll to = g[v][it];
            for (int j = 0; j <= min1; j++)
                ff[j].clear();
            dfs2(v, 0, to);
            for (int j = 0; j <= min1; j++) {
                sort(ff[j].begin(), ff[j].end());
                reverse(ff[j].begin(), ff[j].end());
                for (int k = 0; k < ff[j].size(); k++)
                    a[j][k] = max(a[j][k], ff[j][k]);
            }

            for (int j = 0; j <= min1; j++)
                ff[j].clear();
            dfs2(to, 0, v);
            for (int j = 0; j <= min1; j++) {
                sort(ff[j].begin(), ff[j].end());
                reverse(ff[j].begin(), ff[j].end());
                for (int k = 0; k < ff[j].size(); k++)
                    a[j][k] = max(a[j][k], ff[j][k]);
            }

            ll ans1 = 1;
            for (int j = 0; j < min1; j++) {
                if (a[j][0] != 0)
                    ans1 *= a[j][0];
            }
            ans = min(ans, ans1*2);
        }
        for (int j = 0; j <= min1; j++) {
            for (int k = 0; k <= 110; k++)
                a[j][k] = 0;
        }
        for (int it = 0; it < g[v].size(); it++) {
            ll to = g[v][it];
            for (int j = 0; j <= min1; j++)
                ff[j].clear();
            dfs2(to, 0, v);
            for (int j = 0; j <= min1; j++) {
                sort(ff[j].begin(), ff[j].end());
                reverse(ff[j].begin(), ff[j].end());
                for (int k = 0; k < ff[j].size(); k++)
                    a[j][k] = max(a[j][k], ff[j][k]);
            }
        }
        ll ans1 = 1;
        for (int j = 0; j < min1; j++) {
            if (a[j][0] != 0)
                ans1 *= a[j][0];
        }
        ans = min(ans, (ll)(g[v].size())*ans1);
        cout << ans << endl;
    }
    return 0;
}


Measured memory_bytes: 4352