#include <bits/stdc++.h>
using namespace std;
inline int read() {
  int x = 0, f = 1;
  char ch = getchar();
  while (ch < '0' || ch > '9') {
    if (ch == '-') f = -1;
    ch = getchar();
  }
  while (ch >= '0' && ch <= '9') {
    x = x * 10 + ch - '0';
    ch = getchar();
  }
  return x * f;
}
int c[400010][26], size[400010], n;
int son[400010], dep[400010], tot, Ans[400010];
inline void dfs(int rt) {
  size[rt] = 1;
  for (int i = 0; i < 26; i++)
    if (c[rt][i]) {
      Ans[dep[rt] + 1]++;
      dep[c[rt][i]] = dep[rt] + 1;
      dfs(c[rt][i]);
      size[rt] += size[c[rt][i]];
      if (size[c[rt][i]] > size[son[rt]]) son[rt] = c[rt][i];
    }
}
pair<int, int> s[400010];
int cnt;
inline void calc(int x1, int x2) {
  if (!x2) assert(0);
  for (int i = 0; i < 26; i++)
    if (c[x1][i]) {
      if (c[x2][i])
        tot++, calc(c[x1][i], c[x2][i]);
      else
        c[x2][i] = c[x1][i], s[++cnt] = make_pair(x2, i);
    }
}
int main() {
  n = read();
  for (int i = 1; i < n; i++) {
    int u = read(), v = read();
    char s[3];
    scanf("%s", s);
    c[u][s[0] - 'a'] = v;
  }
  dfs(1);
  for (int i = 1; i <= n; i++) {
    cnt = 0;
    tot = 0;
    for (int j = 0; j < 26; j++)
      if (son[i] != c[i][j] && c[i][j]) calc(c[i][j], son[i]);
    for (int j = 1; j <= cnt; j++) c[s[j].first][s[j].second] = 0;
    Ans[dep[i] + 1] += tot;
  }
  int mx = 0;
  for (int i = 1; i <= n; i++)
    if (Ans[i] > Ans[mx]) mx = i;
  cout << n - Ans[mx] << endl << mx << endl;
}
