#include <iostream>
#include <sstream>
#include <cstdio>
#include <cstdlib>
#include <cmath>
#include <ctime>
#include <cstring>
#include <string>
#include <vector>
#include <stack>
#include <queue>
#include <deque>
#include <map>
#include <set>
#include <bitset>
#include <numeric>
#include <utility>
#include <iomanip>
#include <algorithm>
#include <functional>
#include <unordered_map>
using namespace std;

#define REP(i, s) for (int i = 0; i < s; ++i)
#define ALL(v) (v.begin(), v.end())
#define COUT(x) cout << #x << " = " << (x) << " (L" << __LINE__ << ")" << endl
#define EACH(i, s) for (__typeof__((s).begin()) i = (s).begin(); i != (s).end(); ++i)

template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
template<class T1, class T2> ostream& operator << (ostream &s, pair<T1,T2> P)
{ return s << '<' << P.first << ", " << P.second << '>'; }
template<class T> ostream& operator << (ostream &s, vector<T> P)
{ for (int i = 0; i < P.size(); ++i) { if (i > 0) { s << " "; } s << P[i]; } return s; }
template<class T> ostream& operator << (ostream &s, vector<vector<T> > P)
{ for (int i = 0; i < P.size(); ++i) { s << endl << P[i]; } return s << endl; }
template<class T> ostream& operator << (ostream &s, set<T> P)
{ EACH(it, P) { s << "<" << *it << "> "; } return s << endl; }
template<class T1, class T2> ostream& operator << (ostream &s, map<T1,T2> P)
{ EACH(it, P) { s << "<" << it->first << "->" << it->second << "> "; } return s << endl; }



int N;
vector<vector<int> > G;


vector<int> Prev;
pair<int,int> DiameterDFS(const vector<vector<int> > &G, int v, int p) {
    pair<int,int> res(v, 0);
    for (int i = 0; i < (int)G[v].size(); ++i) {
        if (G[v][i] == p) continue;
        pair<int,int> tmp = DiameterDFS(G, G[v][i], v);
        tmp.second++;
        if (tmp.second > res.second) {
            res = tmp;
            Prev[G[v][i]] = v;
        }
    }
    return res;
}

vector<int> Diameter(const vector<vector<int> > &G) {
    Prev = vector<int>((int)G.size(), -1);
    pair<int,int> leaf = DiameterDFS(G, 0, -1);
    Prev = vector<int>((int)G.size(), -1);
    pair<int,int> t = DiameterDFS(G, leaf.first, -1);
    vector<int> res;
    int cur = t.first;
    while (cur != -1) {
        res.push_back(cur);
        cur = Prev[cur];
    }
    return res;
}


int maxdepth;
long long maxdeg[2100];

void reset() {
    maxdepth = 0;
    for (int i = 0; i < 2100; ++i) maxdeg[i] = 1;
}


void rec(int v, int p, int depth) {
    long long con = 0;
    for (auto e : G[v]) {
        if (e == p) continue;
        ++con;
        rec(e, v, depth+1);
    }
    chmax(maxdepth, depth);
    chmax(maxdeg[depth], con);
}

long long calc() {
    long long res = 1;
    for (int d = 0; d <= maxdepth; ++d) {
        res *= maxdeg[d];
        //cout << d << ": " << maxdeg[d] << endl;
    }
    return res;
}

int main() {
    while (cin >> N) {
        G.clear(); G.resize(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> dpath = Diameter(G);
        int d = (int)dpath.size();
        
        //COUT(dpath);
        
        cout << (d + 1) / 2 << " ";
        long long res = 1;
        if (d % 2 == 0) {
            int u = dpath[d/2-1];
            int v = dpath[d/2];
            reset();
            maxdeg[0] = 2;
            rec(u, v, 1);
            rec(v, u, 1);
            res = calc();
        }
        else {
            int c = dpath[d/2];
            
            // c
            reset();
            maxdeg[0] = (long long)G[c].size();
            for (auto v : G[c]) {
                rec(v, c, 1);
            }
            res = calc();
            
            // vc
            for (auto v : G[c]) {
                reset();
                maxdeg[0] = 2;
                rec(v, c, 1);
                rec(c, v, 1);
                chmin(res, calc());
            }
        }

        cout << res << endl;
    }
}
























Measured memory_bytes: 256