#include <bits/stdc++.h>
using namespace std;
template <class T>
inline void rread(T& num) {
  num = 0;
  T f = 1;
  char ch = getchar();
  while (ch < '0' || ch > '9') {
    if (ch == '-') f = -1;
    ch = getchar();
  }
  while (ch >= '0' && ch <= '9') num = num * 10 + ch - '0', ch = getchar();
  num *= f;
}
inline int getgcd(int x, int y) {
  if (!x) return y;
  return getgcd(y % x, x);
}
inline int power(int x, int k, int p) {
  int res = 1;
  for (; k; k >>= 1, x = (long long)x * x % p)
    if (k & 1) res = (long long)res * x % p;
  return res;
}
const double pi = acos(-1);
inline void judge() { freopen("input.txt", "r", stdin); }
const int maxn = 3e5 + 5;
int n, ndtot, mxdep;
int son[maxn << 2][26], sz[maxn << 2], ans[maxn];
inline int merge(int x, int y) {
  if (!x || !y) return x + y;
  int z = ++ndtot;
  sz[z] = 1;
  for (int(i) = (0); (i) < (26); (i)++) {
    son[z][i] = merge(son[x][i], son[y][i]);
    sz[z] += sz[son[z][i]];
  }
  return z;
}
inline void dfs(int x, int dep) {
  sz[x] = 1;
  mxdep = max(mxdep, dep);
  for (int(i) = (0); (i) < (26); (i)++)
    if (son[x][i]) {
      dfs(son[x][i], dep + 1);
      sz[x] += sz[son[x][i]];
    }
  ndtot = n;
  ans[dep] += sz[x];
  int hhy = 0;
  for (int(i) = (0); (i) < (26); (i)++) hhy = merge(hhy, son[x][i]);
  ans[dep] -= max(1, sz[hhy]);
}
int main() {
  rread(n);
  ndtot = n;
  for (int(i) = (1); (i) <= (n - 1); (i)++) {
    int x, y;
    rread(x);
    rread(y);
    char w;
    scanf("%c", &w);
    son[x][w - 'a'] = y;
  }
  dfs(1, 1);
  for (int(i) = (1); (i) <= (mxdep); (i)++) ans[i] = n - ans[i];
  int wrt = 1;
  for (int(i) = (2); (i) <= (mxdep); (i)++)
    if (ans[i] < ans[wrt]) wrt = i;
  printf("%d\n%d\n", ans[wrt], wrt);
  return 0;
}
