#include <bits/stdc++.h>
int32_t get_economy(std::vector<int32_t> joined_roots, int32_t** tree) {
  if (joined_roots.size() == 1) return 0;
  int32_t res = joined_roots.size() - 1;
  std::vector<int32_t> join_lists[26];
  for (int32_t i = 0; i < joined_roots.size(); i++)
    for (int32_t j = 0; j < 26; j++)
      if (tree[joined_roots[i]][j] != -1)
        join_lists[j].push_back(tree[joined_roots[i]][j]);
  for (int32_t i = 0; i < 26; i++)
    if (join_lists[i].size() > 0) res += get_economy(join_lists[i], tree);
  return res;
}
int main() {
  std::ios::sync_with_stdio(false);
  std::cin.tie(0);
  int32_t n;
  std::cin >> n;
  int32_t** tree = new int32_t*[n];
  for (int32_t i = 0; i < n; i++) {
    tree[i] = new int32_t[26];
    for (int32_t j = 0; j < 26; j++) tree[i][j] = -1;
  }
  int32_t* parents = new int32_t[n];
  for (int32_t i = 0; i < n - 1; i++) {
    int32_t src, dst;
    char ch;
    std::cin >> src >> dst >> ch;
    src--;
    dst--;
    parents[dst] = src;
    tree[src][ch - 'a'] = dst;
  }
  std::vector<int32_t> removed;
  for (int32_t j = 0; j < 26; j++)
    if (tree[0][j] != -1) removed.push_back(tree[0][j]);
  int32_t min_size = n, best_cut = -1;
  int32_t cur_cut = 0;
  while (removed.size() > 0) {
    std::map<int32_t, std::vector<int32_t> > groups_per_parent;
    for (int32_t i = 0; i < removed.size(); i++)
      groups_per_parent[parents[removed[i]]].push_back(removed[i]);
    int32_t total_economy = removed.size();
    for (auto it = groups_per_parent.begin(); it != groups_per_parent.end();
         it++) {
      std::vector<int32_t> join_lists[26];
      for (int32_t i = 0; i < it->second.size(); i++)
        for (int32_t j = 0; j < 26; j++)
          if (tree[it->second[i]][j] != -1)
            join_lists[j].push_back(tree[it->second[i]][j]);
      for (int32_t i = 0; i < 26; i++)
        if (join_lists[i].size() > 0)
          total_economy += get_economy(join_lists[i], tree);
    }
    if (n - total_economy < min_size) {
      min_size = n - total_economy;
      best_cut = cur_cut;
    }
    std::vector<int32_t> new_removed;
    for (int32_t i = 0; i < removed.size(); i++)
      for (int32_t j = 0; j < 26; j++)
        if (tree[removed[i]][j] != -1)
          new_removed.push_back(tree[removed[i]][j]);
    removed = new_removed;
    cur_cut++;
  }
  std::cout << min_size << "\n" << best_cut + 1;
}
