#include <iostream>
#include <iomanip>
#include <cmath>
#include <algorithm>
#include <vector>
#include <queue>
#include <map>
#include <set>
using namespace std;


void dfs(int N, vector<vector<int>> &G, vector<int> &d, int s){
    for(auto t : G[s]){
        if(d[t] != 1<<30) continue;
        d[t] = d[s] + 1;
        dfs(N, G, d, t);
    }
}

vector<int> dpt(200, 0);

void dfs2(int N, vector<vector<int>> &G, vector<bool> &vis, int s, int depth){
    if(vis[s]) return;
    vis[s] = true;
    int cnt = 0;
    for(int t : G[s]){
        if(!vis[t]) cnt++;
        dfs2(N, G, vis, t, depth+1);
    }
    dpt[depth] = max(dpt[depth], cnt);
}

void dfs3(int N, vector<vector<int>> &G, vector<bool> &vis, int s, int depth, int c2){
    if(vis[s]) return;
    vis[s] = true;
    int cnt = 0;
    for(int t : G[s]){
        if(t == c2) continue;
        if(!vis[t]) cnt++;
        dfs3(N, G, vis, t, depth+1, c2);
    }
    dpt[depth] = max(dpt[depth], cnt);
}


pair<int, long long> solve(int N, vector<vector<int>> &G, int c){
    fill(dpt.begin(), dpt.end(), 0);
    vector<bool> vis(N, false);
    dfs2(N, G, vis, c, 0);
    long long ans = 1;
    for(int i=0; i<200; i++)
        if(dpt[i] != 0) ans *= dpt[i];

    int d = 0;
    for(int i=0; i<200; i++)
        if(dpt[i] != 0) d = max(d, i+2);
    return make_pair(d, ans);
}

pair<int, long long> solve(int N, vector<vector<int>> &G, int c1, int c2){
    fill(dpt.begin(), dpt.end(), 0);
    vector<bool> vis(N, false);
    dfs3(N, G, vis, c1, 0, c2);
    dfs3(N, G, vis, c2, 0, c1);
    long long ans = 1;
    for(int i=0; i<200; i++)
        if(dpt[i] != 0) ans *= dpt[i];
    int d = 0;
    for(int i=0; i<200; i++)
        if(dpt[i] != 0) d = max(d, i+2);

    return make_pair(d, 2*ans);
}

int main(){
    int N;
    cin >> N;
    vector<vector<int>> G(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);
    }
    if(N == 2){
        cout << 1 << " " << 2 << endl;
        return 0;
    }

    vector<int> d(N, 1<<30);
    d[0] = 0;
    dfs(N, G, d, 0);

    int id = max_element(d.begin(), d.end()) - d.begin();
    vector<int> d2(N, 1<<30);
    d2[id] = 0;
    dfs(N, G, d2, id);
    int id2 = max_element(d2.begin(), d2.end()) - d2.begin();

    vector<int> d3(N, 1<<30);
    d3[id2] = 0;
    dfs(N, G, d3, id2);

    int dmx = d2[id2];
    if(dmx % 2 == 0){
        int id3;
        vector<bool> flg1(N, true);
        for(int i=0; i<N; i++)
            if(d2[i] != dmx / 2) flg1[i] = false;
        for(int i=0; i<N; i++)
            if(d3[i] != dmx / 2) flg1[i] = false;
        for(int i=0; i<N; i++)
            if(flg1[i]) id3 = i;

        auto sol = solve(N, G, id3);
        int dep = sol.first;
        long long ans = sol.second;

        for(auto t : G[id3]){
            sol = solve(N, G, id3, t);
            int dep0 = sol.first;
            long long ans0 = sol.second;
            if(dep0 == dep){
                ans = min(ans, ans0);
            }
        }
        cout << dep << " " << ans << endl;
    }else{
        int id3, id4;
        vector<bool> flg1(N, true), flg2(N, true);
        for(int i=0; i<N; i++){
            if(d2[i] != dmx / 2) flg1[i] = false;
            if(d2[i] != dmx / 2 + 1) flg2[i] = false;
        }
        for(int i=0; i<N; i++){
            if(d3[i] != dmx / 2) flg2[i] = false;
            if(d3[i] != dmx / 2 + 1) flg1[i] = false;
        }
        for(int i=0; i<N; i++){
            if(flg1[i])
                id3 = i;
            if(flg2[i])
                id4 = i;
        }
        auto sol = solve(N, G, id3, id4);
        cout << sol.first << " " << sol.second << endl;
    }

    return 0;
}


Measured memory_bytes: 256