#include <bits/stdc++.h>
using namespace std;
#pragma comment(linker, "/STACK:102400000,102400000")
long long mul(long long a, long long b) { return (a * b) % (1000000007); }
long long add(long long a, long long b) { return (a + b) % (1000000007); }
long long sub(long long a, long long b) {
  return ((a - b) % (1000000007) + (1000000007)) % (1000000007);
}
void upd(long long &a, long long b) {
  a = (a % (1000000007) + b % (1000000007)) % (1000000007);
}
int read() {
  int x = 0, f = 1;
  char ch = getchar();
  while (!isdigit(ch)) {
    if (ch == '-') f = -1;
    ch = getchar();
  }
  while (isdigit(ch)) {
    x = x * 10 + ch - '0';
    ch = getchar();
  }
  return x * f;
}
struct node {
  int ch[26];
} t[(912345)];
int n, cnt, c[(912345)] = {};
int merge(int x, int y, int d) {
  if (!x || !y) return x + y;
  c[d]++;
  int p = ++cnt;
  for (int i = 0; i < 26; i++) t[p].ch[i] = merge(t[x].ch[i], t[y].ch[i], d);
  return p;
}
void dfs(int u, int d) {
  for (int i = 0; i < 26; i++)
    if (t[u].ch[i]) dfs(t[u].ch[i], d + 1);
  int rt = 0;
  for (int i = 0; i < 26; i++) rt = merge(rt, t[u].ch[i], d);
  if (rt) c[d]++;
}
int main() {
  n = read();
  for (int i = 1; i <= n - 1; i++) {
    int u, v;
    char c;
    scanf("%d %d %c", &u, &v, &c);
    t[u].ch[c - 'a'] = v;
  }
  cnt = n;
  dfs(1, 1);
  cout << n - *max_element(c, c + n) << endl;
  cout << (max_element(c, c + n) - c) << endl;
  return 0;
}
