#include <bits/stdc++.h>
using namespace std;
int tree[500000][30], size[500000], pre[500000][30], h[500000];
int i, m, n, t, x, y;
char c;
inline int dfs2(int x, int y) {
  int t = 1;
  for (int i = 1; i <= 26; i++)
    if ((tree[x][i]) && (tree[y][i]))
      t = t + dfs2(tree[x][i], tree[y][i]);
    else if (!tree[y][i])
      pre[y][i] = tree[y][i], tree[y][i] = tree[x][i];
  return t;
}
inline void dfs3(int x, int y) {
  for (int i = 1; i <= 26; i++)
    if (tree[x][i])
      if (tree[y][i] == tree[x][i])
        tree[y][i] = pre[y][i], pre[y][i] = 0;
      else
        dfs3(tree[x][i], tree[y][i]);
  return;
}
inline void dfs1(int x, int y) {
  int s = 0, t = 0;
  m = max(m, y);
  size[x] = 1;
  for (int i = 1; i <= 26; i++)
    if (tree[x][i]) {
      dfs1(tree[x][i], y + 1);
      size[x] = size[x] + size[tree[x][i]];
      if ((!t) || (size[tree[x][t]] < size[tree[x][i]])) t = i;
    }
  if (t) {
    s++;
    for (int i = 1; i <= 26; i++)
      if ((i != t) && (tree[x][i])) s = s + dfs2(tree[x][i], tree[x][t]);
  }
  if (t)
    for (int i = 26; i > 0; i--)
      if ((i != t) && (tree[x][i])) dfs3(tree[x][i], tree[x][t]);
  h[y] = h[y] + s;
  return;
}
int main() {
  scanf("%d", &n);
  for (i = 1; i < n; i++) {
    scanf("%d%d", &x, &y);
    getchar(), c = getchar();
    tree[x][c - 96] = y;
  }
  dfs1(1, 0);
  for (i = 1; i <= m; i++)
    if (h[i] > h[t]) t = i;
  printf("%d\n%d\n", n - h[t], t + 1);
  return 0;
}
