#include <iostream>
#include <cstdio>
#include <cstring>
#include <vector>
#include <set>
#include <queue>
using namespace std;

const int MAXN = 100;
int N;
set<int> vertex;
vector<int> edge[MAXN + 1];

struct Node {
    int now;
    vector<int> path;
};

vector<int> longest_path(int v) 
{
    bool visit[MAXN + 1];
    memset(visit, false, sizeof(visit));
    queue<Node> q;
    Node start;
    start.now = v;
    start.path.clear();
    start.path.push_back(v);
    q.push(start);
    visit[v] = true;
    int maxlen = 0;
    vector<int> longest_path;
    while (!q.empty()) {
        start = q.front();
        q.pop();
        if (start.path.size() > maxlen) {
            maxlen = start.path.size();
            longest_path = start.path;
        }
        for (int i = 0; i < edge[start.now].size(); i++) {
            int next = edge[start.now][i];
            if (visit[next]) {
                continue;
            }
            visit[next] = true;
            Node temp;
            temp.now = next;
            temp.path = start.path;
            temp.path.push_back(next);
            q.push(temp);
        }
    }
    return longest_path;
}

long long fork_tree(vector<int> heads, int root) 
{
    int level[MAXN / 2 + 1];
    int height = 1;
    int head_size = heads.size();
    level[height] = 1;
    bool visit[MAXN + 1];
    memset(visit, false, sizeof(visit));
    for (int i = 0; i < heads.size(); i++) {
        visit[heads[i]] = true;
    }
    if (root != -1) {
        visit[root] = true;
    }
    bool deeper = true;
    while (deeper) {
        deeper = false;
        int maxchild = 0;
        vector<int> new_heads;
        for (int i = 0; i < heads.size(); i++) {
            int head = heads[i];
            int child = 0;
            for (int j = 0; j < edge[head].size(); j++) {
                if (visit[edge[head][j]]) {
                    continue;
                }
                // there is a child
                visit[edge[head][j]] = true;
                deeper = true;
                child++;
                new_heads.push_back(edge[head][j]);
            }
            maxchild = max(maxchild, child);
        }
        if (deeper) {
            height++;
            level[height] = maxchild;
            heads = new_heads;
        } 
    }    
    long long complete = 1;
    for (int i = 1; i <= height; i++) {
        // cout << level[i] << " ";
        complete *= level[i];
    }
    // cout << "\n";
    return head_size * complete;
}

int main() 
{
    // freopen("./input.txt", "r", stdin);
    // freopen("./output.txt", "w", stdout);

    scanf("%d", &N);
    for (int i = 0; i < N - 1; i++) {
        int a, b;
        scanf("%d %d", &a, &b);
        vertex.insert(a);        
        vertex.insert(b);
        edge[a].push_back(b);
        edge[b].push_back(a);        
    }
    
    int v = *vertex.begin();
    vector<int> lpath = longest_path(v);
    v = lpath[lpath.size() - 1];
    lpath = longest_path(v);
    /* for (int i = 0; i < lpath.size(); i++) {
        cout << lpath[i] << " ";
    }
    cout << "\n"; */
    int color = lpath.size() / 2;
    long long ans = -1;
    if (lpath.size() % 2 != 0) {
        color++;
        int center = lpath[color - 1];
        vector<int> heads;
        for (int i = 0; i < edge[center].size(); i++) {
            int another_center = edge[center][i];
            heads.clear();
            heads.push_back(center);
            heads.push_back(another_center);
            if (ans == -1) {
                ans = fork_tree(heads, -1);
            } else {
                ans = min(ans, fork_tree(heads, -1));                
            }
        }
        heads.clear();
        for (int i = 0; i < edge[center].size(); i++) {
            heads.push_back(edge[center][i]);
        }
        ans = min(ans, fork_tree(heads, center));
                
    } else {
        int c1 = lpath[color];
        int c2 = lpath[color - 1];
        vector<int> heads;
        heads.push_back(c1);        
        heads.push_back(c2);        
        ans = fork_tree(heads, -1);
    }
    
    printf("%d %lld\n", color, ans);
    
	return 0;
}

Measured memory_bytes: 256