#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;
}
inline void wrote(int x) {
  if (x < 0) putchar('-'), x = -x;
  if (x >= 10) wrote(x / 10);
  putchar(x % 10 + '0');
}
inline void writeln(int x) {
  wrote(x);
  puts("");
}
const int N = 300010;
char s[10];
struct data {
  int x, y;
} q[N];
int to[N * 2][30];
int dep[N], pre[N], sz[N], n, clk, del, sum, son[N], answ[N], answ_now, cho, tt;
void merge(int x, int y) {
  for (int i = 0; i <= 25; ++i)
    if (to[y][i]) {
      if (to[x][i])
        ++del, merge(to[x][i], to[y][i]);
      else {
        to[x][i] = to[y][i];
        q[++tt].x = x;
        q[tt].y = i;
      }
    }
}
void dfs(int x) {
  dep[x] = dep[pre[x]] + 1;
  sz[x] = 1;
  sum = max(sum, dep[x]);
  answ[dep[x] - 1]++;
  for (int i = 0; i <= 25; ++i)
    if (to[x][i]) {
      pre[to[x][i]] = x, dfs(to[x][i]), sz[x] += sz[to[x][i]];
      if (sz[to[x][i]] > sz[son[x]]) son[x] = to[x][i];
    }
  if (!son[x]) return;
  del = 0;
  ++clk;
  for (int i = 0; i <= 25; ++i)
    if (to[x][i] && to[x][i] != son[x]) merge(son[x], to[x][i]);
  answ[dep[x]] += del;
  for (int i = 1; i <= tt; ++i) to[q[i].x][q[i].y] = 0;
  tt = 0;
}
int main() {
  n = read();
  for (int i = 2; i <= n; ++i) {
    int x = read(), y = read();
    scanf("%s", s);
    to[x][s[0] - 'a'] = y;
  }
  dfs(1);
  for (int i = 1; i <= sum; ++i)
    if (answ[i] > answ_now) answ_now = answ[i], cho = i;
  writeln(n - answ_now);
  writeln(cho);
}
