#include <bits/stdc++.h>
using namespace std;
const int maxn = 3e5 + 5;
int nxt[maxn][26];
int n;
int siz[maxn], dep[maxn];
void dfs1(int u) {
  siz[u] = 1;
  for (auto v : nxt[u])
    if (v) {
      dep[v] = dep[u] + 1;
      dfs1(v);
      siz[u] += siz[v];
    }
}
int ans[maxn], uni[maxn];
int count(int *a, int sz) {
  if (sz == 0) return 0;
  if (sz == 1) return siz[a[1]];
  int ans = 1;
  for (int i = 0; i < 26; i++) {
    int b[27], n = 0;
    for (int j = 1; j <= sz; j++) {
      if (nxt[a[j]][i]) {
        b[++n] = nxt[a[j]][i];
      }
    }
    ans += count(b, n);
  }
  return ans;
}
void dfs2(int u) {
  int son[27], sz = 0;
  for (int i = 0; i < 26; i++)
    if (nxt[u][i]) {
      int v = nxt[u][i];
      dfs2(v);
      son[++sz] = v;
    }
  if (sz) {
    uni[u] = count(son, sz);
  } else
    uni[u] = 1;
}
int main() {
  cin >> n;
  for (int i = 1; i < n; i++) {
    int u, v;
    char c;
    cin >> u >> v >> c;
    nxt[u][c - 'a'] = v;
  }
  dfs1(1);
  dfs2(1);
  int dsf2;
  for (int i = 0; i <= n; i++) ans[i] = n;
  for (int i = 1; i <= n; i++) {
    ans[dep[i]] += uni[i] - siz[i];
  }
  int p = min_element(ans, ans + n) - ans;
  cout << ans[p] << endl;
  cout << p + 1 << endl;
  return 0;
}
