#include <bits/stdc++.h>
using namespace std;
template <typename T, typename U>
inline void chkmax(T& x, U y) {
  if (x < y) x = y;
}
template <typename T, typename U>
inline void chkmin(T& x, U y) {
  if (y < x) x = y;
}
const int MAXN = 333333;
int con[MAXN][26];
int ans[MAXN];
int process(vector<int> a) {
  int ret = a.size() - 1;
  for (int j = 0; j < 26; j++) {
    vector<int> b;
    for (int i = 0; i < a.size(); i++)
      if (con[a[i]][j]) b.push_back(con[a[i]][j]);
    if (b.size() <= 1) continue;
    ret += process(b);
  }
  return ret;
}
void dfs(int u, int d) {
  vector<int> ret;
  for (int i = 0; i < 26; i++) {
    if (con[u][i]) {
      ret.push_back(con[u][i]);
    }
  }
  ans[d] += process(ret) + 1;
  for (int i = 0; i < 26; i++) {
    if (con[u][i]) dfs(con[u][i], d + 1);
  }
}
int main() {
  int n;
  scanf("%d", &n);
  for (int i = 1; i < n; i++) {
    int u, v;
    char c[3];
    scanf("%d%d%s", &u, &v, c);
    con[u][c[0] - 'a'] = v;
  }
  dfs(1, 1);
  int mx = -1, id = 0;
  for (int i = 1; i <= n; i++)
    if (ans[i] > mx) mx = ans[i], id = i;
  printf("%d\n%d\n", n - mx, id);
  return 0;
}
