#pragma GCC optimize("Ofast")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx")
#include <bits/stdc++.h>
using std::cerr;using std::cin;using std::cout;using std::abs;using std::min;using std::max;using std::swap;using std::map;using std::pair;using std::set;using std::string;using std::vector;
using ll=long long;using uint=unsigned int;using pii=pair<int,int>;using pll=pair<ll,ll>;using ull = unsigned long long;
#define ff first
#define ss second
#define pb emplace_back
template<typename T>void _dbg(const char*_s,T _h){cerr<<_s<<" = "<<_h<<"\n";}
template<typename T,typename...Ts>void _dbg(const char*_s,T _h,Ts..._t){int _b=0;while(((_b+=*_s=='(')-=*_s==')')!=0||*_s!=',')cerr<<*_s++;cerr<<" = "<<_h<<",";_dbg(_s+1,_t...);}
#ifdef LOCAL
#define dbg(...) _dbg(#__VA_ARGS__, __VA_ARGS__)
#else
#define dbg(...) 
#endif
struct init{init(){cin.tie(0);std::iostream::sync_with_stdio(0);cout<<std::fixed<<std::setprecision(10);cerr<<std::fixed<<std::setprecision(5);}~init(){
#ifdef LOCAL
cerr<<"Time elapsed: "<<(double)clock()/CLOCKS_PER_SEC<<"s.\n";
#endif
}}init;

const int MAXN = 111;
set<int> g[MAXN];
set<int> gs[MAXN];
int u[MAXN];
ull d[MAXN];
const ull INF = 1e18;
ull mxw = 0;
void dfs(int v, int start, ull w = 0) {
    u[v] = 1;
    ull ch = g[v].size();
    if (v != start)
        --ch;
    dbg(v, ch);
    d[w] = max(d[w], ch);
    mxw = max(mxw, w);
    for (int to : g[v])
        if (!u[to])
            dfs(to, start, w + 1);
}

int32_t main() {
    
    int n;
    cin >> n;
    for (int i = 1; i < n; ++i) {
        int a, b;
        cin >> a >> b;
        g[a].insert(b);
        g[b].insert(a);
        gs[a].insert(b);
        gs[b].insert(a);
    }

    ull ans = INF, leaves = 0;

    for (int i = 1; i <= n; ++i) {
        memset(u, 0, sizeof u);
        memset(d, 0, sizeof d);
        mxw = 0;
        dfs(i, i);
        ull pot = mxw + 1;
        ull plv = 1;
        bool okay = 1;
        for (int j = 0; okay && j < mxw; ++j) {
            if (d[j] > INF / plv) okay = 0;
            plv *= d[j];
        }
        if (!okay) continue;
        if (ans > pot || (ans == pot && leaves > plv))
            ans = pot, leaves = plv;
    }

    for (int i = 1; i <= n; ++i) {
        for (int to : gs[i]) {
            g[0].clear();
            g[0].insert(i);
            g[i].insert(0);
            g[0].insert(to);
            g[to].insert(0);
            g[i].erase(to);
            g[to].erase(i);
            memset(u, 0, sizeof u);
            memset(d, 0, sizeof d);
            mxw = 0;
            dfs(0, 0);
            g[i].erase(0);
            g[to].erase(0);
            g[i].insert(to);
            g[to].insert(i);
            ull pot = mxw;
            ull plv = 1;
            bool okay = 1;
            for (int j = 0; okay && j < mxw; ++j) {
                dbg(j, d[j]);
                if (d[j] > INF / plv) okay = 0;
                plv *= d[j];
            }
            dbg(i, to, mxw, plv);
            if (!okay) continue;
            if (ans > pot || (ans == pot && leaves > plv))
                ans = pot, leaves = plv;  
        }
    }

    cout << ans << ' ' << leaves << '\n';

    return 0;
}


Measured memory_bytes: 256