#include <iostream>
#include <algorithm>
#include <iomanip>
#include <vector>
#include <queue>
#include <set>
#include <map>

using namespace std;
typedef long long ll;

vector<int> G[101];
bool used[101];
bool isLeaf[101];
int dist[101];
int p[101];
int N;
ll c[101];

void clear(){
    for(int i = 0; i < N; i++){
        used[i] = false;
    }
}

void dfs(int v, int d){
    used[v] = true;
    dist[v] = d;
    for(int i = 0; i < G[v].size(); i++){
        if(!used[G[v][i]]){
            p[G[v][i]] = v;
            dfs(G[v][i], d+1);            
        }
    }
}

void dfs1(int v, int d){
    //cout << v << endl;
    used[v] = true;
    dist[v] = d;
    int cnt = 0;
    for(int i = 0; i < G[v].size(); i++){
        if(!used[G[v][i]]){
            p[G[v][i]] = v;
            dfs1(G[v][i], d+1);
            cnt++;          
        }
    }
    c[d] = max(c[d], (ll)cnt);
}

vector<int> r;

ll calc(){
    clear();
    dfs(0, 0);
    clear();
    int dist_max = -1;
    int end;
    for(int i = 0; i < N; i++){
        if(dist[i] > dist_max){
            end = i;
            dist_max = dist[i];
        }
    }
    clear();
    p[end] = end;
    dfs(end, 0);
    dist_max = -1;
    for(int i = 0; i < N; i++){
        if(dist[i] > dist_max){
            end = i;
            dist_max = dist[i];
        }
    }
    int tmp = end;
    while(p[tmp] != tmp){
        r.push_back(tmp);
        tmp = p[tmp];
    }
    r.push_back(tmp);
    int s = r.size();
    for(int i = 0; i < N; i++) dist[i] = -1;
    if(s%2 == 0){
        dist[r[s/2-1]] = 1;
        dist[r[s/2]] = 1;
        c[0] = 2;
        clear();
        used[r[s/2-1]] = true;
        used[r[s/2]] = true;
        dfs1(r[s/2-1], 1);
        dfs1(r[s/2], 1);
    }else{
        dist[r[s/2]] = 0;
        clear();
        dfs1(r[s/2], 0);
    }
    ll ans = 1;
    for(int i = 0; i < s/2; i++) {
        ans *= c[i];
       // cout << c[i] << ' ';
    }
    //cout << endl;
    return ans;
}

int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout << setprecision(10) << fixed;
    cin >> N;
    for(int i = 0; i < N-1; i++){
        int a, b;
        cin >> a >> b;
        a--; b--;
        G[a].push_back(b);
        G[b].push_back(a);
    }

    ll ans;
    ll tmp = calc();
    ans = tmp;
    int s = r.size();
    r.clear();
    for(int i = 0; i < N; i++) c[i] = 0;
    for(int i = 0; i < N; i++) {
        if(G[i].size() == 1) isLeaf[i] = true;
    }
    int N_ = N;
    N++;
    if(s%2 == 1){
        int i = r[s/2];
        for(int j = 0; j < G[i].size(); j++){
            int to = G[i][j];
            dist[i] = 1;
            dist[to] = 1;
            c[0] = 2;
            clear();
            used[i] = true;
            used[to] = true;
            dfs1(i, 1);
            dfs1(to, 1);
            ll tmp = 1;
            for(int i = 0; i < s/2+1; i++) {
                tmp *= c[i];
                //cout << c[i] << ' ';
            }
            //cout << endl;
            if(tmp < ans) {
                ans = tmp;
            }
            //r.clear();
            for(int i = 0; i < N; i++) c[i] = 0;
            //cout << tmp << endl;
        }
    }
    cout <<(s+1)/2 << ' ' << ans << endl;
}

Measured memory_bytes: 256