#include<bits/stdc++.h>
using namespace std;
using ll = long long;

// #undef DEBUG
// #define DEBUG
/// {{{ DEBUG --- ///
template <typename T> ostream &operator<<(ostream &o, const vector<T> &v) { if(&o == &cerr) { o << '{'; for(size_t i = 0; i < v.size(); i++) o << v[i] << (i + 1 != v.size() ? ", " : ""); o << "}"; } else { for(size_t i = 0; i < v.size(); i++) o << v[i] << (i + 1 != v.size() ? " " : ""); } return o; }
#ifdef DEBUG
#define dump(...) (cerr<<"["<<__LINE__<< "] "<<#__VA_ARGS__<<" = "<<make_tuple(__VA_ARGS__)<<"\n")
template<int n, class...T> typename enable_if<(n>=sizeof...(T))>::type _ot(ostream &, tuple<T...> const &){}
template<int n, class...T> typename enable_if<(n< sizeof...(T))>::type _ot(ostream & os, tuple<T...> const & t){ os << (n==0?"":", ") << get<n>(t); _ot<n+1>(os, t); }
template<class...T> ostream & operator<<(ostream &o, tuple<T...> const &t){ o << "("; _ot<0>(o, t); o << ")"; return o; }
#else
#define dump(...) (0)
#endif
/// }}}--- ///

const int N = 100;
int dep[N];
int dep2[N];
vector<int> g[N];

template <class T, class U> inline void smax(T &a, U b) { a = a > b ? a : b; }
template <class T, class U> inline void smin(T &a, U b) { a = a < b ? a : b; }

void dfs(int i, int p = -1, int d = 0) {
  dep[i] = d;
  for(int j : g[i]) if(j != p) {
    dfs(j, i, d + 1);
  }
}

int dfs2(int i, int go, int p = -1, int d = 0) {
  dep2[i] = d;
  int f = i == go;
  for(int j : g[i]) if(j != p) {
    f |= dfs2(j, go, i, d + 1);
  }
  if(!f) dep2[i] = -1;
  return f;
}

int main() {
  ios::sync_with_stdio(false), cin.tie(0);
  int n; cin >> n;
  for(int i = 0; i < n - 1; i++) {
    int a, b;
    cin >> a >> b;
    a--; b--;
    g[a].emplace_back(b);
    g[b].emplace_back(a);
  }
  dfs(0);
  int d1 = 0, d2 = 0;
  for(int i = 0; i < n; i++) if(dep[i] > dep[d1]) d1 = i;
  dfs(d1);
  for(int i = 0; i < n; i++) if(dep[i] > dep[d2]) d2 = i;
  if(dep[d2] % 2) {
    // center is edge
    vector<int> v;
    dfs2(d1, d2);
    int dis = dep[d2] / 2;
    for(int i = 0; i < n; i++) if(dep2[i] == dis || dep2[i] == dis + 1) v.emplace_back(i);
    dump(v);
    dfs(v[0], v[1]);
    dfs(v[1], v[0]);
    vector<int> deg(N);
    for(int i = 0; i < n; i++) {
      smax(deg[dep[i]], g[i].size() - 1);
    }
    ll ans = 1;
    for(int i = 0; i < n; i++) {
      if(deg[i] != 0) ans *= deg[i];
    }
    cout << dis + 1 << " " << ans * 2 << endl;
  } else {
    // center is vertex
    int center = 0;
    int dis = dep[d2] / 2;
    dfs2(d1, d2);
    for(int i = 0; i < n; i++) if(dep2[i] == dep[d2] / 2) center = i;
    dfs(center);
    vector<int> deg(N);
    for(int i = 0; i < n; i++) {
      smax(deg[dep[i]], g[i].size() - 1);
    }
    ll ans = 1;
    for(int i = 1; i < n; i++) {
      if(deg[i] != 0) ans *= deg[i];
    }
    ans *= g[center].size();
    for(int j : g[center]) {
      dfs(center, j);
      dfs(j, center);
      vector<int> deg(N);
      for(int i = 0; i < n; i++) {
        smax(deg[dep[i]], g[i].size() - 1);
      }
      ll res = 1;
      for(int i = 0; i < n; i++) {
        if(deg[i] != 0) res *= deg[i];
      }
      smin(ans, res * 2);
      dump(j, center, res);
    }
    cout << dis + 1 << " " << ans << endl;
  }
}



Measured memory_bytes: 256