#include <bits/stdc++.h>
using namespace std;
int n;
struct Tree {
  int c[26];
} tree[600005];
int root;
int cnt[600005];
int merge(int x, int y, int d) {
  if (!x || !y) return x + y;
  int New = ++root;
  cnt[d]++;
  for (int i = 0; i < 26; i++)
    tree[New].c[i] = merge(tree[x].c[i], tree[y].c[i], d);
  return New;
}
void dfs(int now, int d) {
  int rt = 0;
  for (int i = 0; i < 26; i++) rt = merge(rt, tree[now].c[i], d);
  if (rt) cnt[d]++;
  for (int i = 0; i < 26; i++)
    if (tree[now].c[i]) dfs(tree[now].c[i], d + 1);
}
int main() {
  scanf("%d", &n);
  for (int i = 0; i < n - 1; i++) {
    int a, b;
    char c[5];
    scanf("%d%d%s", &a, &b, c);
    tree[a].c[c[0] - 'a'] = b;
  }
  root = n;
  dfs(1, 1);
  cout << n - *max_element(cnt, cnt + n) << endl;
  cout << max_element(cnt, cnt + n) - cnt << endl;
}
