#include<iomanip>
#include<limits>
#include<thread>
#include<utility>
#include<iostream>
#include<string>
#include<algorithm>
#include<set>
#include<map>
#include<vector>
#include<stack>
#include<queue>
#include<cmath>
#include<numeric>
#include<cassert>
#include<random>
#include<chrono>
#include<unordered_set>
#include<unordered_map>
#include<fstream>
#include<list>
#include<functional>
#include<bitset>
#include<complex>
#include<tuple>
using namespace std;
typedef unsigned long long int ull;
typedef long long int ll;
typedef pair<ll,ll> pll;
typedef pair<int,int> pi;
typedef pair<double,double> pd;
typedef pair<double,ll> pdl;
#define F first
#define S second
const ll E=1e18+7;
const ll MOD=1000000007;


ll n;
vector<vector<ll>> edge;
vector<ll> M;
vector<ll> mx;
ll h=E;

ll dfs1(ll w,ll p){
    ll ret=1;
    for(auto &I:edge[w]){
        if(I!=p){
            ret=max(ret,dfs1(I,w)+1);
        }
    }
    mx[w]=ret;
    return ret;
}

void dfs2(ll w,ll p,ll pn){
    pn++;
    mx[w]=max(mx[w],pn);
    pll mx1={pn,p};
    pll mx2={1,w};
    if(mx1<mx2){swap(mx1,mx2);}
    for(auto &I:edge[w]){
        if(I!=p){
            if(mx2<pll(mx[I]+1,I)){mx2={mx[I]+1,I};}
            if(mx2>mx1){swap(mx2,mx1);}
        }
    }
    for(auto &I:edge[w]){
        if(I!=p){
            if(I==mx1.S){dfs2(I,w,mx2.F);}
            else{dfs2(I,w,mx1.F);}
        }
    }
}

vector<vector<ll>> dp;

void dfs3(ll w,ll p,ll root,ll d){
    if(dp[root].size()==d){dp[root].push_back(1);}
    ll ch=0;
    for(auto &I:edge[w]){
        if(I!=p){
            ch++;
            dfs3(I,w,root,d+1);
        }
    }
    dp[root][d]=max(dp[root][d],ch);
}



int main(){
    cin>>n;
    edge.resize(n);
    mx.resize(n,0);
    dp.resize(n);
    for(int i=1;i<n;i++){
        ll a,b;
        cin>>a>>b;
        a--; b--;
        edge[a].push_back(b);
        edge[b].push_back(a);
    }
    dfs1(0,-1);
    dfs2(0,-1,0);
    for(auto &I:mx){h=min(I,h);}
    for(int i=0;i<n;i++){if(mx[i]==h){M.push_back(i);}}
    //for(auto &I:mx){cout<<I<<endl;}
    if(M.size()==2){
        dfs3(M[0],M[1],M[0],0);
        dfs3(M[1],M[0],M[1],0);
        ll ans=1;
        for(int i=0;i+1<h;i++){ans*=max(dp[M[0]][i],dp[M[1]][i]);}
        //cout<<M[0]<<" "<<M[1]<<endl;
        //for(int i=0;i+1<h;i++){cout<<i<<" "<<dp[M[0]][i]<<" "<<dp[M[1]][i]<<endl;}
        cout<<h-1<<" "<<ans*2<<endl;
    }
    else{
        assert(M.size()==1);
        for(auto &I:edge[M[0]]){
            dp[I].push_back(1);
            dfs3(I,M[0],I,1);
        }
        ll ans=E;
        for(auto &I:edge[M[0]]){
            vector<ll> A(n,1);
            A[0]=max(A[0],(ll)edge[M[0]].size()-1);
            for(auto &T:edge[M[0]]){
                if(I==T){
                    for(int i=1;i<dp[T].size();i++){A[i-1]=max(A[i-1],dp[T][i]);}
                }
                else{
                    for(int i=0;i<dp[T].size();i++){A[i]=max(A[i],dp[T][i]);}
                }
            }
            ll c=1;
            for(auto &I:A){c*=I;}
            //cout<<I<<" "<<c*2<<endl;
            ans=min(ans,c*2);
        }
        vector<ll> A(n,1);
        A[0]=max(A[0],(ll)edge[M[0]].size());
        for(auto &T:edge[M[0]]){
            for(int i=0;i<dp[T].size();i++){A[i]=max(A[i],dp[T][i]);}
        }
        ll c=1;
        for(auto &I:A){c*=I;}
        ans=min(ans,c);
        //cout<<c<<endl;
        cout<<h<<" "<<ans<<endl;
    }
    
    
    return 0;
}


Measured memory_bytes: 256