#include <bits/stdc++.h>
using namespace std;
const int N = 300005;
int n;
int tree[N][26];
int dep[N];
int ans[N];
void dfs(int u, int d) {
  dep[u] = d;
  for (int i = 0; i < 26; i++) {
    if (tree[u][i]) {
      dfs(tree[u][i], d + 1);
    }
  }
}
int dfs(vector<int> vec) {
  int sz = vec.size();
  if (sz <= 1) return 0;
  int t = sz - 1;
  for (int j = 0; j < 26; j++) {
    vector<int> vi;
    for (int i = 0; i < sz; i++) {
      if (tree[vec[i]][j]) {
        vi.push_back(tree[vec[i]][j]);
      }
    }
    t += dfs(vi);
  }
  return t;
}
int main() {
  scanf("%d", &n);
  int u, v;
  char w;
  for (int i = 1; i < n; i++) {
    scanf("%d%d %c", &u, &v, &w);
    tree[u][w - 'a'] = v;
  }
  dfs(1, 0);
  for (int i = 1; i <= n; i++) {
    vector<int> vec;
    for (int j = 0; j < 26; j++) {
      if (tree[i][j]) vec.push_back(tree[i][j]);
    }
    if (vec.size() > 0) ans[dep[i]] += dfs(vec) + 1;
  }
  int Max = 0, id = 0;
  for (int i = 0; i <= n; i++) {
    if (ans[i] > Max) Max = ans[i], id = i;
  }
  printf("%d\n%d\n", n - Max, id + 1);
  return 0;
}
