#include <bits/stdc++.h>
using namespace std;
template <class T, class S>
ostream& operator<<(ostream& os, const pair<T, S>& v) {
  return os << "(" << v.first << ", " << v.second << ")";
}
template <class T>
ostream& operator<<(ostream& os, const vector<T>& v) {
  os << "[";
  for (int i = int(0); i <= int((static_cast<int>((v).size())) - 1); ++i) {
    if (i) os << ", ";
    os << v[i];
  }
  return os << "]";
}
template <class T>
bool setmax(T& _a, T _b) {
  if (_a < _b) {
    _a = _b;
    return true;
  }
  return false;
}
template <class T>
bool setmin(T& _a, T _b) {
  if (_b < _a) {
    _a = _b;
    return true;
  }
  return false;
}
template <class T>
T gcd(T _a, T _b) {
  return _b == 0 ? _a : gcd(_b, _a % _b);
}
struct Node {
  int child[26];
  Node() { memset(child, -1, sizeof(child)); }
};
int main() {
  int n;
  scanf("%d", &n);
  vector<Node> tr(n * 2);
  for (int i = int(0); i <= int((n - 1) - 1); ++i) {
    int x, y;
    char s[9];
    scanf("%d%d%s", &x, &y, s);
    --x, --y;
    tr[x].child[int(s[0] - 'a')] = y;
  }
  vector<int> reduction(n);
  const function<int(int, int)> dfs = [&](int x, int dep) {
    int cur = n;
    const function<int(int, int)> merge = [&cur, &merge, &tr](int x, int y) {
      if (x < 0) return y;
      if (y < 0) return x;
      int z = cur++;
      tr[z] = Node();
      for (int ch = int(0); ch <= int((26) - 1); ++ch) {
        tr[z].child[ch] = merge(tr[x].child[ch], tr[y].child[ch]);
      }
      return z;
    };
    int size = 1;
    for (int ch = int(0); ch <= int((26) - 1); ++ch)
      if (tr[x].child[ch] >= 0) {
        int y = tr[x].child[ch];
        size += dfs(y, dep + 1);
      }
    if (size > 1) {
      int z = -1;
      for (int ch = int(0); ch <= int((26) - 1); ++ch)
        if (tr[x].child[ch] >= 0) {
          int y = tr[x].child[ch];
          z = merge(z, y);
        }
      reduction[dep] += cur - n + 1;
    }
    return size;
  };
  dfs(0, 0);
  int k = 0;
  for (int i = int(0); i <= int((n)-1); ++i)
    if (reduction[i] > reduction[k]) k = i;
  printf("%d\n%d\n", n - reduction[k], k + 1);
  return 0;
}
