#include <bits/stdc++.h>
using namespace std;
int IN() {
  int c, f, x;
  while (!isdigit(c = getchar()) && c != '-')
    ;
  c == '-' ? (f = 1, x = 0) : (f = 0, x = c - '0');
  while (isdigit(c = getchar())) x = (x << 1) + (x << 3) + c - '0';
  return !f ? x : -x;
}
const int N = 6e5 + 19;
int sz[N], val[N], a[N], b[N], trs[N][26];
int n, x, y, res, top;
char s[10];
void calc(int x, int y, int dep) {
  val[dep]++;
  for (int i = 0; i < 26; i++)
    if (trs[x][i]) {
      if (!trs[y][i]) {
        top++;
        a[top] = y;
        b[top] = i;
        trs[y][i] = trs[x][i];
      } else {
        calc(trs[x][i], trs[y][i], dep);
      }
    }
}
void dfs(int x, int dep) {
  int son = 0;
  sz[x] = 1;
  for (int i = 0; i < 26; i++) {
    int y = trs[x][i];
    if (!y) continue;
    dfs(y, dep + 1);
    sz[x] += sz[y];
    if (sz[y] > sz[son]) son = y;
  }
  if (son) val[dep]++;
  for (int i = 0; i < 26; i++) {
    int y = trs[x][i];
    if (!y || y == son) continue;
    calc(y, son, dep);
  }
  for (; top; top--) {
    trs[a[top]][b[top]] = 0;
  }
}
int main() {
  n = IN();
  for (int i = 1; i < n; i++) {
    x = IN(), y = IN();
    scanf("%s", s);
    trs[x][s[0] - 'a'] = y;
  }
  dfs(1, 1);
  res = 0;
  for (int i = 1; i < n + 1; i++)
    if (val[i] > val[res]) res = i;
  printf("%d\n", n - val[res]);
  printf("%d\n", res);
}
