/**
 *   @FileName	a.cpp
 *   @Author	kanpurin
 *   @Created	2020.08.17 03:16:41
**/

#include "bits/stdc++.h" 
using namespace std; 
typedef long long ll;

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);
    }
    
    vector< int > dist(n, -1);
    queue< int > que;
    que.push(0);
    dist[0] = 0;
    int max_v, max_val = 0;
    while (!que.empty()) {
        int v = que.front();
        que.pop();
        for (int u : g[v]) {
            if (dist[u] != -1) continue;
            dist[u] = dist[v] + 1;
            if (max_val < dist[u]) {
                max_v = u;
                max_val = dist[u];
            }
            que.push(u);
        }
    }
    vector< int > dist1(n, -1);
    que = queue< int >();
    que.push(max_v);
    dist1[max_v] = 0;
    max_val = 0;
    while (!que.empty()) {
        int v = que.front();
        que.pop();
        for (int u : g[v]) {
            if (dist1[u] != -1) continue;
            dist1[u] = dist1[v] + 1;
            if (max_val < dist1[u]) {
                max_v = u;
                max_val = dist1[u];
            }
            que.push(u);
        }
    }
    vector< int > dist2(n, -1);
    que = queue< int >();
    que.push(max_v);
    dist2[max_v] = 0;
    while (!que.empty()) {
        int v = que.front();
        que.pop();
        for (int u : g[v]) {
            if (dist2[u] != -1) continue;
            dist2[u] = dist2[v] + 1;
            que.push(u);
        }
    }
    
    if (max_val % 2 == 0) {
        int v1;
        for (int i = 0; i < n; i++) {
            if (dist1[i] == max_val / 2 && dist2[i] == max_val / 2) {
                v1 = i;
            }
        }
        ll ans = 1e18 + 1;
        
        dist = vector< int >(n, -1);
        vector< int > max_child_cnt(max_val + 1, 1);
        stack< int > sta;
        sta.push(v1);
        dist[v1] = 0;
        while (!sta.empty()) {
            int v = sta.top();
            sta.pop();
            int child_cnt = 0;
            for (int u : g[v]) {
                if (dist[u] != -1) continue;
                dist[u] = dist[v] + 1;
                child_cnt++;
                sta.push(u);
            }
            max_child_cnt[dist[v]] = max(max_child_cnt[dist[v]], child_cnt);
        }
        ll ans2 = 1;
        for (int i = 0; i <= max_val; i++) {
            ans2 *= max_child_cnt[i];
        }
        ans = min(ans, ans2);
        
        for (int v2 : g[v1]) {
            dist = vector< int >(n, -1);
            vector< int > max_child_cnt(max_val + 1, 1);
            stack< int > sta;
            sta.push(v1);
            sta.push(v2);
            dist[v1] = 0;
            dist[v2] = 0;
            while (!sta.empty()) {
                int v = sta.top();
                sta.pop();
                int child_cnt = 0;
                for (int u : g[v]) {
                    if (dist[u] != -1) continue;
                    dist[u] = dist[v] + 1;
                    child_cnt++;
                    sta.push(u);
                }
                
                max_child_cnt[dist[v]] = max(max_child_cnt[dist[v]], child_cnt);
            }
            ans2 = 2;
            for (int i = 0; i <= max_val; i++) {
                ans2 *= max_child_cnt[i];
            }
            
            
            ans = min(ans, ans2);
        }
        cout << max_val / 2 + 1 << " " << ans << endl;
    }
    
    else {
        int v1, v2;
        for (int i = 0; i < n; i++) {
            if (dist1[i] == max_val / 2 && dist2[i] == max_val / 2 + 1) {
                v1 = i;
            } else if (dist2[i] == max_val / 2 && dist1[i] == max_val / 2 + 1) {
                v2 = i;
            }
        }
        dist = vector< int >(n, -1);
        vector< int > max_child_cnt(max_val + 1, 1);
        stack< int > sta;
        sta.push(v1);
        sta.push(v2);
        dist[v1] = 0;
        dist[v2] = 0;
        while (!sta.empty()) {
            int v = sta.top();
            sta.pop();
            int child_cnt = 0;
            for (int u : g[v]) {
                if (dist[u] != -1) continue;
                dist[u] = dist[v] + 1;
                child_cnt++;
                sta.push(u);
            }
            max_child_cnt[dist[v]] = max(max_child_cnt[dist[v]], child_cnt);
        }
        ll ans = 2;
        for (int i = 0; i <= max_val; i++) {
            ans *= max_child_cnt[i];
        }
        cout << (max_val + 1) / 2 << " " << ans << endl;
    }
    return 0;
}

Measured memory_bytes: 3620