#include <bits/stdc++.h>
#define rep(i, a, b) for(ll i = ll(a); i < ll(b); i++)
#define rer(i, a, b) for(ll i = ll(a) - 1; i >= ll(b); i--)
#define sz(v) (int)(v).size()
#define pb push_back
#define sc second
#define fr first
#define sor(v) sort(v.begin(),v.end())
#define rev(s) reverse(s.begin(),s.end())
#define lb(vec,a) lower_bound(vec.begin(),vec.end(),a)
#define ub(vec,a) upper_bound(vec.begin(),vec.end(),a)
#define uniq(vec) vec.erase(unique(vec.begin(),vec.end()),vec.end())
using namespace std;
typedef long long int ll;
typedef pair <int, int> P;

const int INF=100000;
const int MAX_V=100;
vector<int> E[MAX_V];
int d[MAX_V][MAX_V]; //存在しない場合はINF, d[i][i]=0
int V;
int s,t;
bool used[MAX_V];
vector<int> v;
vector<int> ans;
vector<int> l[MAX_V];
vector<int> r[MAX_V];
void warshall_floyd(){
    rep(k,0,V){
        rep(i,0,V){
            rep(j,0,V){
                d[i][j]=min(d[i][j],d[i][k]+d[k][j]);
            }
        }
    }
}

void restore(int a){
    used[a]=1;
    v.pb(a);
    if(a==t) ans=v;
    else{
        rep(i,0,sz(E[a])){
            if(used[E[a][i]]==0){
                restore(E[a][i]);
            }
        }
    }
    v.pop_back();
}

ll solve(int x,int y){
    rep(i,0,MAX_V) l[i].clear();
    rep(i,0,MAX_V) r[i].clear();
    rep(i,0,MAX_V) used[i]=0;
    ll A;
    if(x==y) A=1;
    else A=2;
    used[x]=1;
    used[y]=1;
    if(x!=y){
        l[0].pb(x);
        r[0].pb(y);
    }
    else{
        l[0].pb(x);
    }
    rep(i,0,100){
        int m=1;
        rep(j,0,sz(l[i])){
            m=max(m,sz(E[l[i][j]]));
            rep(k,0,sz(E[l[i][j]])){
                if(used[E[l[i][j]][k]]==0){
                    l[i+1].pb(E[l[i][j]][k]);
                    used[E[l[i][j]][k]]=1;
                }
            }
        }
        rep(j,0,sz(r[i])){
            m=max(m,sz(E[r[i][j]]));
            rep(k,0,sz(E[r[i][j]])){
                if(used[E[r[i][j]][k]]==0){
                    r[i+1].pb(E[r[i][j]][k]);
                    used[E[r[i][j]][k]]=1;
                }
            }
        }
        if(x==y&&i==0) A*=m;
        else A*=max(m-1,1);
    }
    return A;
}
int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    cin>>V;
    rep(i,0,V){
        rep(j,0,V){
            d[i][j]=INF;
        }
    }
    rep(i,0,V-1){
        int a,b;
        cin>>a>>b;
        d[a-1][b-1]=1;
        d[b-1][a-1]=1;
        E[a-1].pb(b-1);
        E[b-1].pb(a-1);
    }
    warshall_floyd();
    int M=0;
    rep(i,0,V){
        rep(j,i+1,V){
            M=max(M,d[i][j]);
        }
    }
    rep(i,0,V){
        rep(j,i+1,V){
            if(M==d[i][j]){
                s=i;
                t=j;
            }
        }
    }
    restore(s);
    rep(i,0,V) used[i]=0;
    ll A;
    if(M%2){
        l[0].pb(ans[M/2]);
        r[0].pb(ans[M/2+1]);
        used[ans[M/2]]=1;
        used[ans[M/2+1]]=1;
        A=2;
        rep(i,0,100){
            int m=1;
            rep(j,0,sz(l[i])){
                m=max(m,sz(E[l[i][j]]));
                rep(k,0,sz(E[l[i][j]])){
                    if(used[E[l[i][j]][k]]==0){
                        l[i+1].pb(E[l[i][j]][k]);
                        used[E[l[i][j]][k]]=1;
                    }
                }
            }
            rep(j,0,sz(r[i])){
                m=max(m,sz(E[r[i][j]]));
                rep(k,0,sz(E[r[i][j]])){
                    if(used[E[r[i][j]][k]]==0){
                        r[i+1].pb(E[r[i][j]][k]);
                        used[E[r[i][j]][k]]=1;
                    }
                }
            }
            A*=max(m-1,1);
        }
        cout <<M/2+1<<" "<<A<<"\n";
    }
    else{
        ll a;
        a=solve(ans[M/2], ans[M/2]);
        ll b=a;
        rep(i,0,sz(E[ans[M/2]])){
            b=min(b,solve(ans[M/2], E[ans[M/2]][i]));
        }
        cout <<M/2+1<<" "<<b<<"\n";
    }
}

Measured memory_bytes: 256