#include <bits/stdc++.h>
#define re return
#define pb push_back
#define po pop_back
#define all(x) (x).begin(), (x).end()
#define fi first
#define se second
#define ss second.second
#define sf second.first
#define ff first.first
#define fs first.second
#define si size
#define sqrt(x) sqrt(abs(x))
#define mp make_pair
#define pi 3.14159265359
#define er erase
#define in insert
#define em empty
#define ft front
#define fo(i,n) for(i = 0; i < n; i++)
#define ro(i,n) for(i = n - 1; i >= 0; i--)
#define fr(i,j,n) for(i = j; i < n; i++)
#define rf(i,j,n) for(i=n-1;i>=j;i--)
typedef std::vector<int> vi;
typedef std::vector<vi> vvi;
typedef std::pair<int,int> ii;
typedef std::vector<ii> vii;
typedef std::vector<std::string> vs;
typedef double dl;
typedef long double ld;
typedef long long ll;
typedef std::pair<ll, ll> pll;
typedef std::vector<ll> vll;
#define filename ""
using namespace std;
    vector<int> v[105];
    int r=0;
pair<int,int> dfs(int x,int pr=-1)
{
    int i;
    pair<int,int> o={-1,x};
    fo(i,v[x].size())
    {
        if (v[x][i]==pr) continue;
        o=max(o,dfs(v[x][i],x));
    }
    o.fi++;
    re o;
}
    int was[105];
    queue<int> q0,q;
bool f(int x,int d=0,int pr=-1)
{
    int i;
    bool o=0;
    if (d==r) o=1;
    fo(i,v[x].size())
    {
        if (v[x][i]==pr)
        {
            continue;
        }
        o=max(o,f(v[x][i],d+1,x));
    }
    if (o)
    {
        if (d==r/2||(r-d)==r/2)
        {
            q0.push(x);
            was[x]=1;
        }
    }
    re o;
}
pair<int,int> g(int x)
{
    int i;
    pair<int,int> c={0,0};
    fo(i,v[x].size())
    {
        if (v[v[x][i]].size()==c.fi)
        {
            c.se++;
        }
        c=max(c,{v[v[x][i]].size(),1});
    }
    re c;
}
    ll kolver[105];
    pair<int,ll> ans={105,0};
void aaa(int x,int y=-1)
{
    //cout<<x<<' '<<y<<' ';
    memset(was,0,sizeof(was));
    memset(kolver,0,sizeof(kolver));
    int i;
    q0.push(x);
    if (y>-1)
    {
        q0.push(y);
        was[y]=1;
    }
    kolver[1]=q0.size();
    int o1=1;
    x=q0.front();
    was[x]=1;
    if (q0.size()==2)
    {
        kolver[2]=max(kolver[2],(ll)v[x].size()-1);
    }
    else
    {
        kolver[2]=max(kolver[2],(ll)v[x].size());
    }
    q0.pop();
    fo(i,v[x].size())
    {
        if (!was[v[x][i]])
        {
            q.push(v[x][i]);
            was[v[x][i]]=was[x]+1;
        }
    }
    if (!q0.empty())
    {
        x=q0.front();
        kolver[2]=max(kolver[2],(ll)v[x].size()-1);
        q0.pop();
        fo(i,v[x].size())
        {
            if (!was[v[x][i]])
            {
                q.push(v[x][i]);
                was[v[x][i]]=was[x]+1;
            }
        }
    }
    while(!q.empty())
    {
        x=q.front();
        q.pop();
        kolver[was[x]+1]=max(kolver[was[x]+1],(ll)v[x].size()-1);
        o1=max(o1,was[x]);
        fo(i,v[x].size())
        {
            if (!was[v[x][i]])
            {
                q.push(v[x][i]);
                was[v[x][i]]=was[x]+1;
            }
        }
    }/*
    fo(i,5)
    {
        cout<<was[i]<<' ';
    }*/
    ll o2=1;
    fr(i,1,o1+1)
    {
        o2*=kolver[i];
        //cout<<kolver[i]<<' ';
    }
    //cout<<'\n';
    if (o1==ans.fi)
    {
        if (o2<ans.se)
        {
            ans.se=o2;
        }
    }
    else
    {
        if (o1<ans.fi)
        {
            ans={o1,o2};
        }
    }
}
int main()
{
    /*
	freopen(filename".in","r",stdin);
	freopen(filename".out","w",stdout);
	*/
	/*
	freopen("input.txt","r",stdin);
	freopen("output.txt","w",stdout);
    */
    /*
    ios::sync_with_stdio(0);
    */
    int n;
    int i,a,b;
    cin>>n;
    fo(i,n-1)
    {
        scanf("%d%d",&a,&b);
        v[a-1].pb(b-1);
        v[b-1].pb(a-1);
    }
    int j;
    fo(i,n)
    {
        aaa(i);
        fo(j,v[i].size())
        {
            aaa(i,v[i][j]);
        }
    }
    cout<<ans.fi<<' '<<ans.se;
}


Measured memory_bytes: 256