#include <bits/stdc++.h>
#define GET_MACRO(_1,_2,_3,_4,_5,_6,NAME,...) NAME
#define pr(...) GET_MACRO(__VA_ARGS__,pr6,pr5,pr4,pr3,pr2,pr1)(__VA_ARGS__)
#define Pr(a) (#a)<<"="<<(a)<<" "
#define pr1(a) cerr<<Pr(a)<<endl
#define pr2(a,b) cerr<<Pr(a)<<Pr(b)<<endl
#define pr3(a,b,c) cerr<<Pr(a)<<Pr(b)<<Pr(c)<<endl
#define pr4(a,b,c,d) cerr<<Pr(a)<<Pr(b)<<Pr(c)<<Pr(d)<<endl
#define pr5(a,b,c,d,e) cerr<<Pr(a)<<Pr(b)<<Pr(c)<<Pr(d)<<Pr(e)<<endl
#define pr6(a,b,c,d,e,f) cerr<<Pr(a)<<Pr(b)<<Pr(c)<<Pr(d)<<Pr(e)<<Pr(f)<<endl
#define int long long
#define double long double
using namespace std;
const int INF = 1LL<<60;
const int mod = (1e9)+7;
const double EPS = 1e-8;
const double PI = 6.0 * asin(0.5);
typedef pair<int,int> P;
typedef long long ll;
template<class T> T Max(T &a,T b){return a=max(a,b);}
template<class T> T Min(T &a,T b){return a=min(a,b);}
ostream& operator<<(ostream& o,P p){return o<<"("<<p.first<<","<<p.second<<")";}
istream& operator>>(istream& i,P &p){return i>>p.first>>p.second;}
ostream& operator<<(ostream& o,vector<auto> &a){int i=0;for(auto t:a)o<<(i++?" ":"")<<t;return o;}
istream& operator>>(istream& i,vector<auto> &a){for(auto &t:a)i>>t;return i;}
void prArr(auto a,string s=" "){int i=0;for(auto t:a)cout<<(i++?s:"")<<t;cout<<endl;}

class DiameterOfTree{
public:
  typedef pair<int,int> P;
  int V;
  vector<vector<P> > G; //(to, cost)
  vector<int> nodeCost; //ノードに重みがある場合
  int start, end, length;
  int ok;
  DiameterOfTree():V(-1){}
  DiameterOfTree(int V):V(V),G(V),nodeCost(V, 0),ok(false){};

  void add_edge(int a,int b,int c = 1){
    ok = false;
    assert(a < V && b < V);
    assert(a >= 0 && b >= 0);
    G[a].push_back( P(b, c) );
    G[b].push_back( P(a, c) );
  }
  
  void dfs(int pos,int pre = -1,int len = 0){
    if(pre == -1) start = pos, length = -1;
    len += nodeCost[pos];
    if(len > length) length = len, end = pos;
    for(P p:G[pos]) if(p.first != pre) dfs(p.first, pos, len+p.second);
  }

  //s-t間のパスを取得 : O(V + E)
  vector<int> getPath(int s,int t){
    assert(s >= 0 && s < V);
    assert(t >= 0 && t < V);
    
    vector<int> res;
    function<int(int,int)> dfs=[&](int pos,int pre){
      if(pos == t) {res.push_back(end); return 1;}
      for(P p:G[pos]){
        int to = p.first;
        if(to != pre && dfs(to, pos)){res.push_back(pos); return 1;}
      }
      return 0;
    };
    
    dfs(s, -1);
    return res;
  }
  
  //O(V + E);
  void build(int start=0){
    ok = true;
    assert(start < V);
    dfs(start);
    dfs(end);
  }
};

int n;
vector<vector<int> > G;

//deg, sum, cnt
tuple<int,int, int> calcMaxDegree(vector<int> &D, queue<int> &Q,int target, int flag){
  int deg = 0,sum = 0, cnt = 0;
  while(!Q.empty()){
    int pos = Q.front();
    int cost = D[pos];
    if(cost > target) break;
    
    if(cost == target) {
      Max(deg, (int)G[pos].size() - flag);
      sum += G[pos].size() - flag;
      cnt++;
    }
    
    Q.pop();
    
    for(int to:G[pos]){
      if(D[to] != -1) continue;
      D[to] = cost + 1;
      Q.push(to);
    }
  }
  return tie(deg, sum, cnt);
}


P solve(vector<int> start){
  vector<int> D(n,-1);
  queue<int> Q;
  for(int s:start){Q.push(s); D[s] = 0;}
  
  int col = 1, leaf = start.size();
  int flag = leaf != 1;
  
  for(int i=0;i<n;i++, flag = 1){
    int deg, sum, cnt; 
    tie(deg, sum, cnt) = calcMaxDegree(D, Q, i, flag);
    if(deg == 0) break;
    col++;
    leaf = leaf * deg;
  }
  return {col, leaf};
}

signed main(){
  cin.tie(0);
  ios_base::sync_with_stdio(0);
  cout << fixed << setprecision(12);
  
  cin>>n;
  G.resize(n);
  
  DiameterOfTree DoT(n);
  for(int i=1;i<n;i++){
    int a, b;
    cin>>a>>b; a--, b--;
    G[a].push_back(b);
    G[b].push_back(a);
    DoT.add_edge(a, b);
  }

  DoT.build();
  vector<int> start;
  auto path = DoT.getPath(DoT.start, DoT.end);
  start.push_back( path[DoT.length/2] );
  if(DoT.length % 2) start.push_back( path[DoT.length/2 + 1] );
  
  P a = solve(start);
  P b = P(INF,INF);
  if(start.size() == 1){
    int center = start[0];
    for(int center2:G[center]){
      start = {center, center2};
      Min(b, solve(start));
    }
  }
  
  P ans = min(a, b);
  cout<<ans.first<<" "<<ans.second<<endl;
  return 0;
}


Measured memory_bytes: 256