#include <bits/stdc++.h>

#define reg register
#define pr std::pair<int, ll>
#define fi first
#define se second
#define FIN(s) freopen(s, "r", stdin)
#define FOUT(s) freopen(s, "w", stdout)
#define debug(...) fprintf(stderr, __VA_ARGS__)
#define rep(i, l, r) for (int i = l; i <= r; ++i)
#define lep(i, l, r) for (int i = l; i < r; ++i)
#define irep(i, r, l) for (int i = r; i >= l; --i)
#define ilep(i, r, l) for (int i = r; i > l; --i)
#define Rep(i, n) rep(i, 1, n)
#define Lep(i, n) lep(i, 1, n)
#define IRep(i, n) irep(i, n, 1)
#define ILep(i, n) ilep(i, n, 1)
typedef long long ll;
typedef long double ld;

namespace modular {
    const int MOD = 1000000007;
    inline int add(int x, int y) { return (x += y) >= MOD ? x -= MOD : x; }
    inline void inc(int &x, int y) { (x += y) >= MOD ? x -= MOD : 0; }
    inline int mul(int x, int y) { return 1LL * x * y % MOD; }
    inline int qpow(int x, int y) {
        int ans = 1;
        for (; y; y >>= 1, x = mul(x, x))
            if (y & 1) ans = mul(ans, x);
        return ans;
    }
};  // namespace modular

namespace Base {
    template <typename Tp>
    inline Tp input() {
        Tp x = 0, y = 1;
        char c = getchar();
        while ((c < '0' || '9' < c) && c != EOF) {
            if (c == '-') y = -1;
            c = getchar();
        }
        if (c == EOF) return 0;
        while ('0' <= c && c <= '9') x = x * 10 + c - '0', c = getchar();
        return x *= y;
    }
    template <typename Tp>
    inline void read(Tp &x) {
        x = input<Tp>();
    }
    template <typename Tp>
    inline void chmax(Tp &x, Tp y) {
        x < y ? x = y : 0;
    }
    template <typename Tp>
    inline void chmin(Tp &x, Tp y) {
        x > y ? x = y : 0;
    }
};  // namespace Base
using namespace Base;
/*----------------------------------------------------------------------------*/

#define MAX_N 107

int N;
int mx[MAX_N];
std::vector<int> G[MAX_N];

struct edge {
    int u, v;
} e[MAX_N];

void dfs(int x, int las, int d = 1) {
    int deg = 0;
    for (int y : G[x])
        if (y != las) {
            dfs(y, x, d + 1);
            deg++;
        }
    chmax(mx[d], deg);
}

int main() {
    read(N);
    Lep(i, N) {
        read(e[i].u), read(e[i].v);
        G[e[i].u].push_back(e[i].v);
        G[e[i].v].push_back(e[i].u);
    }
    pr res = pr(1000, 1e16);
    Rep(i, N) {
        Rep(j, N) mx[j] = 0;
        dfs(i, 0);
        pr ans = pr(0, 1LL);
        Rep(j, N) if (mx[j]) { ans.se *= mx[j]; }
        else {
            ans.fi = j;
            break;
        }
        if (ans.fi < res.fi)
            res = ans;
        else if (ans.fi == res.fi && ans.se < res.se)
            res = ans;
    }
    Lep(i, N) {
        Rep(j, N) mx[j] = 0;
        dfs(e[i].u, e[i].v), dfs(e[i].v, e[i].u);
        pr ans = pr(0, 2LL);
        Rep(j, N) if (mx[j]) { ans.se *= mx[j]; }
        else {
            ans.fi = j;
            break;
        }
        // printf("%d %d %d %d\n", e[i].u, e[i].v, ans.fi, ans.se);
        if (ans.fi < res.fi)
            res = ans;
        else if (ans.fi == res.fi && ans.se < res.se)
            res = ans;
    }
    printf("%d %lld\n", res.fi, res.se);
    return 0;
}


Measured memory_bytes: 256