#include <bits/stdc++.h>
using namespace ::std;
const int maxn = 6e5 + 500;
const int mod = 1e9 + 7;
const int inf = 1e9 + 500;
vector<pair<int, char> > ger[maxn];
int bach[maxn][26];
int par[maxn];
vector<int> hh[maxn];
int siz[maxn];
void dfs(int a, int p = -1, int h = 1) {
  hh[h].push_back(a);
  siz[a] = 1;
  par[a] = p;
  for (auto e : ger[a]) {
    int v = e.first;
    if (v != p) {
      dfs(v, a, h + 1);
      siz[a] += siz[v];
      bach[a][e.second] = v;
    }
  }
}
int p;
int dfss(int a, int b, int pa = -1) {
  int res = 1;
  for (auto e : ger[a]) {
    int v = e.first;
    if (v != pa) {
      if (bach[b][e.second] == 0) {
        bach[b][e.second] = p;
        ger[p].push_back(make_pair(b, e.second));
        ger[b].push_back(make_pair(p, e.second));
        p++;
        res--;
      }
      res += dfss(v, bach[b][e.second], a);
    }
  }
  return res;
}
int n;
int behine(int a) {
  p = n + 1;
  pair<int, int> ma = make_pair(-1, 0);
  for (auto e : ger[a]) {
    int v = e.first;
    if (v != par[a]) {
      ma = max(ma, make_pair(siz[v], v));
    }
  }
  if (ma.first == -1) {
    return 0;
  }
  int res = 1;
  for (auto e : ger[a]) {
    int v = e.first;
    if (v != ma.second && v != par[a]) {
      res += dfss(v, ma.second, a);
    }
  }
  for (int i = n + 1; i < p; i++) {
    memset(&bach[i], 0, 26 * sizeof(int));
    for (auto e : ger[i]) {
      int v = e.first;
      if (v <= n) {
        bach[v][e.second] = 0;
      }
      while (ger[v].size() && ger[v].back().first >= n) {
        ger[v].pop_back();
      }
    }
    ger[i].clear();
  }
  return res;
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  cin >> n;
  for (int i = 1; i < n; i++) {
    int v, u;
    char c;
    cin >> v >> u >> c;
    c -= 'a';
    ger[v].push_back(make_pair(u, c));
    ger[u].push_back(make_pair(v, c));
  }
  dfs(1);
  pair<int, int> ans = make_pair(inf, inf);
  for (int i = 1; i <= n; i++) {
    int res = n;
    for (auto v : hh[i]) {
      res -= behine(v);
    }
    ans = min(ans, make_pair(res, i));
  }
  cout << ans.first << ' ' << ans.second;
}
