#include "bits/stdc++.h"
#define ll long long
#define rep2(i,a,b) for(ll i=a;i<=b;++i)
#define rep(i,n) for(int i=0;i<n;i++)
#define rep3(i,a,b) for(int i=a;i>=b;i--)
#define pii pair<int,int>
#define pll pair<ll,ll>
#define tii tuple<int,int,int>
#define pq priority_queue<int>
#define pqg priority_queue<int,vector<int>,greater<int>>
#define pb push_back
#define edge(v,a,b) v[a].pb(b);v[b].pb(a);
#define MAX_V 400010
#define vec vector<int>
#define vecll vector<ll>
#define vecpii vector<pii>
#define endl "\n"
#define ALL(c) (c).begin(),(c).end()
using namespace std;
int in() {int x;scanf("%d",&x);return x;}
ll lin() {ll x;scanf("%lld",&x);return x;}
template<typename A, size_t NNN, typename T>
void Fill(A (&array)[NNN], const T &val){
    fill( (T*)array, (T*)(array+NNN), val );
}
#define N 100010
#define INF 1e15+7
ll MOD=1e9+7;
vec G[N];
vector<int> Diameter_path(int n){
    if(n==1)return vector<int> {0};
    auto farthest=[&](int start){
        vector<int> depth(n);
        function<void(int,int,int)>get_depth=[&](int u,int prev,int d){
            depth[u]=d;
            for(auto v:G[u]){
                if(v!=prev){
                    get_depth(v,u,d+1);
                }
            }
        };
        get_depth(start,-1,0);
        int maxd=0;
        int res=0;
        rep(i,n){
            if(depth[i]>maxd){
                maxd=depth[i];res=i;
            }
        }
        return res;
    };
    int s=farthest(1);
    int t=farthest(s);
    vector<int> diameter_path;
    function<void(int,int,vector<int>&)> construct=[&](int u,int prev,vector<int> &path){
        if(u==t){
            diameter_path=path;
            return;
        }
        for(auto v:G[u])if(v!=prev){
            path.push_back(v);
            construct(v,u,path);
            path.pop_back();
        }
    };
    vector<int> tmp;tmp.pb(s);
    construct(s,-1,tmp);
    return diameter_path;
}


main(){
    int n=in();
    rep(i,n-1){
        int a=in(),b=in();
        G[a].pb(b);G[b].pb(a);
    }
    vec dpp=Diameter_path(n+1);
    int d=dpp.size();
    cout<<(d+1)/2<<" ";
    vector<vec> dp;
    vec leaf;
    rep2(i,1,n)if(G[i].size()==1)leaf.pb(i);
    int goal;
    vec temppath;
    function<void(int,int,vec)> makepath=[&](int x,int pre,vec path){
        if(x==goal){
            temppath=path;return;
        }
        for(auto v:G[x])
        if(v!=pre){
            path.pb(v);
            makepath(v,x,path);
            path.pop_back();
        }
    };
    rep(i,leaf.size()){
        rep(j,leaf.size()){
            if(i>=j)continue;
            goal=leaf[j];
            vec temp;
            temp.pb(leaf[i]);
            makepath(leaf[i],-1,temp);
            if(temppath.size()==d)dp.pb(temppath);
            vec clear;
            temppath=clear;
        }
    }
    int size[200]={};
    function<void(int,int,int)> dfs=[&](int x,int d,int pre){
        size[d]=max(size[d],(int)(G[x].size()-1));
        rep(i,G[x].size()){
            if(G[x][i]!=pre)dfs(G[x][i],d+1,x);
        }
        return;
    };
    ll ans=-1;
    auto calc=[&](int check){
        ll tempans=1;
        rep(i,200){
            if(!size[i]){
                if(i-check!=(d+1)/2)return;
                break;
            }
            tempans*=size[i];
        }
        if(ans==-1)ans=tempans;
        else ans=min(ans,tempans);
        return;
    };
    rep2(i,1,n){
        dfs(i,0,-1);
        size[0]++;
        calc(-1);
        rep(j,200)size[j]=0;
        for(auto v:G[i]){
            dfs(i,1,v);dfs(v,1,i);
            size[0]=2;
            calc(0);
            Fill(size,0);
        }
    }
    cout<<ans;
}   

Measured memory_bytes: 2944