/*
I've been down this road once or twice before
through the open door
i come falling through it
there's a sign post up ahead
like a watershed
and it opens my eyes
ways, for me to begin
to be born again
and knowing for the first time
ways, all so differently
shine for me to see
the better man that I am

I've been places in my head
behind me worse than what's ahead
and on my path just like a dream
takes me from the inbetween
from out of nowhere you came strong as stone
and now I'll never have to be alone
what it is I know

you have always been my safe home
I walk, I run, I burn out into you
you have always been my safe home
my whole world has moved on

i know what i am and I'll always be
your reality, is better than I could dream
all my fears turn from black to white
and i'd stand and fight
the whole world for you
faith, and destiny
I never did believe
my only god is love and
faith, what I see in you
and I can hold it true
like a weight in my hand.
*/

#pragma GCC optimize("O3")
#define _CRT_SECURE_NO_WARNINGS
#include <fstream>
#include <iostream>
#include <string>
#include <complex>
#include <math.h>
#include <set>
#include <vector>
#include <map>
#include <queue>
#include <stdio.h>
#include <stack>
#include <algorithm>
#include <list>
#include <ctime>

#include <memory.h>
#include <assert.h>

#define y0 sdkfaslhagaklsldk

#define y1 aasdfasdfasdf
#define yn askfhwqriuperikldjk
#define j1 assdgsdgasghsf
#define tm sdfjahlfasfh
#define lr asgasgash
#define norm asdfasdgasdgsd
#define have adsgagshdshfhds
#define ends asdgahhfdsfshdshfd

#define eps 1e-8
#define M_PI 3.141592653589793
#define bsize 512

#define ldouble long double
using namespace std;

#define bs 1000000007

const int N = 600031;

int n,a,b;
vector<int> g[N];
int ans;
int H;

int used[N];

int max_on_dep[N],deg[N];

void reroot(){
	for (int i=1;i<=n;i++)
		used[i]=deg[i]=0;
	for (int i=0;i<=n;i++){
		max_on_dep[i]=0;
	}
}

void dfs(int v,int h){
	H=max(H,h);
	used[v]=1;
	for (int i=0;i<g[v].size();i++){
		int to=g[v][i];
		if (used[to])
			continue;
		deg[v]++;
		dfs(to,h+1);
	}
	max_on_dep[h]=max(max_on_dep[h],deg[v]);
}

long long ans2;

long long get_ans2(){
	long long res=1;
	for (int i=0;i<=n;i++){
		if (max_on_dep[i]>0)
			res*=max_on_dep[i];
	}
	return res;
}

vector<pair<int,int> > edges;

int main(){
//	freopen("apache.in","r",stdin);
//	freopen("apache.out","w",stdout);
	//freopen("input.txt", "r", stdin);
	//freopen("output.txt", "w", stdout);
	ios_base::sync_with_stdio(0);
//	cin.tie(0);

	cin>>n;
	for (int i=1;i<n;i++){
		cin>>a>>b;
		g[a].push_back(b);
		g[b].push_back(a);
		edges.push_back(make_pair(a,b));
	}

	ans=1e9;

	ans2=(1ll<<62)-1;
	ans2*=2;

	for (int i=1;i<=n;i++){
		reroot();
		H=0;
		dfs(i,0);
		long long temp=get_ans2();
		if (H+1<ans||(H+1==ans&&temp<ans2))
			ans=min(ans,H+1),
			ans2=temp;
	}

	for (int i=0;i<edges.size();i++){
		reroot();
		H=0;
		int a=edges[i].first;
		int b=edges[i].second;
		used[a]=used[b]=1;
		dfs(a,0);
		dfs(b,0);
		long long temp=get_ans2();
		temp*=2;
		if (H+1<ans||(H+1==ans&&temp<ans2))
			ans=min(ans,H+1),
			ans2=temp;
	}

	cout<<ans<<" "<<ans2<<endl;


//	cin.get(); cin.get();
	return 0;
}


Measured memory_bytes: 19456