#include <bits/stdc++.h>
using namespace std;
const int N = 3e5 + 100;
const long long INF = 1e9 + 19;
vector<pair<int, int>> e[N];
int n;
int cnt[N];
int dfs2(vector<int> tmp, int v) {
  if (tmp.empty()) return 0;
  vector<int> cur(tmp.size());
  int res = 1;
  for (int i = 0; i < (int)e[v].size(); i++) {
    vector<int> go;
    int ch = e[v][i].second;
    for (int j = 0; j < (int)tmp.size(); j++) {
      int u = tmp[j];
      for (; cur[j] < (int)e[u].size() && e[u][cur[j]].second < ch; cur[j]++)
        ;
      if (cur[j] < (int)e[u].size() && e[u][cur[j]].second == ch) {
        go.push_back(e[u][cur[j]].first);
      }
    }
    res += dfs2(go, e[v][i].first);
  }
  return res;
}
void dfs(int v, int h) {
  for (int i = 0; i < (int)e[v].size(); i++) dfs(e[v][i].first, h + 1);
  int res = 0;
  if (!e[v].empty()) res = 1;
  for (int i = 0; i < (int)e[v].size(); i++) {
    vector<int> tmp;
    for (int j = 0; j < i; j++) tmp.push_back(e[v][j].first);
    res += dfs2(tmp, e[v][i].first);
  }
  cnt[h] += res;
}
int main() {
  scanf("%d", &n);
  for (int i = 0; i < n - 1; i++) {
    int v, u;
    char ch;
    scanf("%d%d %c", &v, &u, &ch);
    v--;
    u--;
    e[v].push_back(make_pair(u, ch - 'a'));
  }
  for (int i = 0; i < n; i++)
    sort((e[i]).begin(), (e[i]).end(), [](pair<int, int> A, pair<int, int> B) {
      return A.second < B.second;
    });
  dfs(0, 0);
  int pos = 0;
  for (int i = 0; i <= n; i++) {
    if (cnt[i] > cnt[pos]) {
      pos = i;
    }
  }
  printf("%d\n%d\n", n - cnt[pos], pos + 1);
  return 0;
}
