#include <cstdio>
#include <cctype>
#include <algorithm>
#include <cstring>
#include <map>
#include <vector>
#include <queue>
#define fi first
#define se second
using namespace std;
typedef long long i64;
typedef pair<int, i64> pii;
inline int read(int f = 1, int x = 0, char ch = ' ')
{
    while(!isdigit(ch = getchar())) if(ch == '-') f = -1;
    while(isdigit(ch)) x = x*10+ch-'0', ch = getchar();
    return f*x;
}
const int N = 1e5+5;
int n, f[N], d[N], dep[N]; vector<int> e[N]; pii ans;
int bfs(int u, int v)
{
    queue<int> q; q.push(u), dep[u] = 1; if(v) q.push(v), dep[v] = 1; int ret = 0;
    while(q.size())
    {
        int x = q.front(); q.pop(); f[dep[x]] = max(f[dep[x]], d[x]), ret = max(ret, dep[x]);
        for(int y:e[x]) if(!dep[y]) dep[y] = dep[x]+1, q.push(y);
    }
    return ret;
}
pii solve(int u, int v)
{   
    for(int i = 1; i <= n; ++i) f[i] = dep[i] = 0;
    pii ret; ret.fi = bfs(u, v), ret.se = f[1]-(v!=0);
    for(int i = 2; i <= n&&f[i] != 1; ++i) ret.se *= f[i]-1;
    if(v) ret.se <<= 1; return ret;
}
int main()
{
    n = read(), ans.fi = n;
    if(n == 2) return puts("1 2"), 0;
    for(int i = 1; i < n; ++i)
    {
        int x = read(), y = read(); ++d[x], ++d[y];
        e[x].push_back(y), e[y].push_back(x);
    }
    for(int i = 1; i <= n; ++i)
    {
        ans = min(ans, solve(i, 0));
        for(int j:e[i]) ans = min(ans, solve(i, j)); 
    }
    printf("%d %lld\n", ans.fi, ans.se);
    return 0;
}