#include <bits/stdc++.h>

using namespace std;

#define SZ(x) (int)(x.size())
#define REP(i, n) for(int i=0;i<(n);++i)
#define FOR(i, a, b) for(int i=(a);i<(b);++i)
#define RREP(i, n) for(int i=(int)(n);i>=0;--i)
#define RFOR(i, a, b) for(int i=(int)(a);i>=(int)(b);--i)
#define ALL(a) (a).begin(),(a).end()
#define DUMP(x) cerr<<#x<<" = "<<(x)<<endl
#define DEBUG(x) cerr<<#x<<" = "<<(x)<<" (L"<<__LINE__<<")"<< endl;

using ll = long long;
using vi = vector<int>;
using vvi = vector<vi>;
using vll = vector<ll>;
using vvll = vector<vll>;
using P = pair<int, int>;

const double eps = 1e-8;
const ll MOD = 1000000007;
const int INF = INT_MAX / 2;
const ll LINF = LLONG_MAX / 2;

template <typename T1, typename T2>
bool chmax(T1 &a, const T2 &b) {
  if(a < b) {a = b; return true;}
  return false;
}

template <typename T1, typename T2>
bool chmin(T1 &a, const T2 &b) {
  if(a > b) {a = b; return true;}
  return false;
}

template<typename T1, typename T2>
ostream& operator<<(ostream &os, const pair<T1, T2> p) {
  os << p.first << ":" << p.second;
  return os;
}

template<class T>
ostream &operator<<(ostream &os, const vector<T> &v) {
  REP(i, SZ(v)) {
    if(i) os << " ";
    os << v[i];
  }
  return os;
}

int depth(int now, int prev, const vvi &g) {
  int ma = 0;
  for(auto &nxt: g[now]) {
    if(nxt == prev) continue;
    int res = depth(nxt, now, g);
    chmax(ma, res+1);
  }
  return ma;
}

void sch(int now, int prev, int depth, const vi &d, const vvi &g, vi &dma) {
  if(depth == 0) dma[0] = d[now];
  else chmax(dma[depth], d[now]-1);
  for(auto nxt: g[now]) {
    if(nxt == prev) continue;
    sch(nxt, now, depth+1, d, g, dma);
  }
}


int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  cout << fixed << setprecision(10);

  int n; cin >> n;
  vvi g(n+10);
  vi d(n);
  REP(i, n-1) {
    int a, b; cin >> a >> b;
    a--; b--;
    g[a].push_back(b);
    g[b].push_back(a);
    d[a]++;
    d[b]++;
  }

  int mi = INF;
  vi argmi;
  REP(i, n) {
    int res = depth(i, -1, g);
    if(res < mi) {
      mi = res;
      argmi.clear();
      argmi.push_back(i);
    } else if(res == mi) {
      argmi.push_back(i);
    }
  }


  int r = -1;
  bool add = false;
  if(SZ(argmi) == 2) {
    add = true;
    r = n;
    int a = argmi[0], b = argmi[1];
    auto it = find(ALL(g[a]), b);
    if(it == g[a].end()) {
      cout << 0 << endl;
      return 0;
    }
    g[a].erase(it);
    it = find(ALL(g[b]), a);
    if(it == g[b].end()) {
      cout << 0 << endl;
      return 0;
    }
    g[b].erase(it);
    g[r].push_back(a);
    g[a].push_back(r);
    g[r].push_back(b);
    g[b].push_back(r);
    d[r] = 2;
    n++;
  } else {
    r = argmi[0];
    mi++;
  }


  vi dma(mi+10);
  sch(r, -1, 0, d, g, dma);
  //cout << dma << endl;

  ll leaf = 1;
  for(auto &e: dma) {
    if(e == 0) break;
    leaf *= e;
  }

  if(!add) {
    for(auto &v: g[r]) {
      dma.clear();
      dma.resize(mi+10);
      dma[0] = 2;
      sch(r, v, 1, d, g, dma);
      sch(v, r, 1, d, g, dma);
      //cout << dma << endl;
      ll nowleaf = 1;
      for(auto &e: dma) {
        if(e == 0) break;
        nowleaf *= e;
      }
      chmin(leaf, nowleaf);
    }
  }

  cout << mi << " " << leaf << endl;
  exit(0);
}
























Measured memory_bytes: 256