#include <cstdio>
#include <algorithm>
#include <cctype>
#include <vector>
#define debug(...) fprintf(stderr,__VA_ARGS__)
#define pb push_back
using namespace std;

inline char nc(){ static char buf[100000] , *p1,*p2; return p1 == p2 && (p2 = (p1 = buf) + fread(buf,1,100000,stdin),p1 == p2) ?  EOF : *p1++;}
template<class T>inline void rd(T & x){ x = 0;char ch = nc(); for(;!isdigit(ch);ch = nc()); for(;isdigit(ch);ch = nc())x = x * 10 - 48 + ch;}
template<class T>inline bool checkMin(T & a,const T b){ return (a < b ? 0 : a = b , 1);}
template<class T>inline bool checkMax(T & a,const T b) { return (a < b ? a = b , 1 : 0);}

const int maxn = 2e5 + 10;
int to[maxn << 1] , nx[maxn << 1] , hd[maxn] , ek = 1;
inline void adde(int u,int v){ to[ek] = v; nx[ek] = hd[u];hd[u] = ek++;}

int dep[maxn] ,anc[maxn];
void dfs(int u,int fa){
    for(int i = hd[u];i;i = nx[i]){
        int v = to[i];
        if(v == fa) continue;
        anc[v] = u;
        dep[v] = dep[u] + 1;
        dfs(v,u);
    }
}

vector<int> sets[maxn];
int n;
typedef long long ll;
ll solve(int u){
    dep[u] = 1;
    dfs(u,u);
    int maxdep = *max_element(dep + 1,dep + n + 1);
    for(int i = 1;i <= maxdep;i++) sets[i].clear();
    for(int i = 1;i <= n;i++) sets[dep[i]].pb(i);
    ll ans = 1;
    for(int i = maxdep - 1;i >= 1;i--){
        int ma = 0;
        for(size_t j = 0;j < sets[i].size();j++){
            int x = sets[i][j];
            int cnt = 0;
            for(int k = hd[x];k;k = nx[k]){
                int v = to[k];
                if(dep[v] == i + 1) cnt++;
            }
            checkMax(ma,cnt);
        }
        ans *= 1ll * ma;
    }
    return ans;
}

ll solve(int u,int v){
    dep[u] = 1;
    dfs(u,u);
    dep[v] = 1;
    dfs(v,u);
    int maxdep = *max_element(dep + 1,dep + n + 1);
    for(int i = 1;i <= maxdep;i++) sets[i].clear();
    for(int i = 1;i <= n;i++) sets[dep[i]].pb(i);
    ll ans = 1;
    for(int i = maxdep - 1;i >= 1;i--){
        int ma = 0;
        for(size_t j = 0;j < sets[i].size();j++){
            int x = sets[i][j];
            int cnt = 0;
            for(int k = hd[x];k;k = nx[k]){
                int v = to[k];
                if(dep[v] == i + 1) cnt++;
            }
            checkMax(ma,cnt);
        }
        ans *= 1ll * ma;
    }
    return ans << 1;
}


int main(int argc, char const *argv[]) {
    // freopen("D.in","r",stdin);
    rd(n);
    for(int i = 1;i < n;i++){
        int u,v;
        rd(u); rd(v);
        adde(u,v);
        adde(v,u);
    }
    dep[1] = 1;
    dfs(1,0);
    int s = 0, t = 0;
    for(int i = 1;i <= n;i++) if(dep[i] > dep[s]) s = i;
    dep[s] = 1;
    dfs(s,0);
    for(int i = 1;i <= n;i++) if(dep[i] > dep[t]) t = i;
    int ans1 = (dep[s] + dep[t]) / 2;
    if(!((dep[s] + dep[t]) & 1)){
        int x = 0;
        for(x = t;dep[x] != ans1;x = anc[x]);
        ll ans2 = solve(x);
        for(int i = hd[x];i;i = nx[i]){
            int v = to[i];
            checkMin(ans2,solve(x,v));
        }
        printf("%d %lld\n",ans1,ans2);
    } else {
        int x1 = 0,x2 = 0;
        for(x1 = t;dep[x1] != ans1;x1 = anc[x1]);
        for(x2 = t;dep[x2] != ans1 + 1;x2 = anc[x2]);
        printf("%d %lld\n",ans1,solve(x1,x2));
    }
    return 0;
}


Measured memory_bytes: 10624