#include <bits/stdc++.h>
using namespace std;
const int N = 3e5 + 10;
int n, cnt;
int u[N], v[N];
char x[N];
int e[N << 1][30];
int dep[N];
int sz[N], son[N];
int del[N], dd[N];
void dfs(int x, int d) {
  dep[x] = d;
  sz[x] = 1;
  for (int i = 0; i < 26; ++i)
    if (e[x][i]) {
      dfs(e[x][i], d + 1);
      sz[x] += sz[e[x][i]];
    }
}
pair<int, int> mrg(int x, int y) {
  if (x == 0 || y == 0) return make_pair(x | y, 0);
  int ret = 0, k = ++cnt;
  for (int i = 0; i < 26; ++i)
    if (e[x][i] && e[y][i]) ret++;
  for (int i = 0; i < 26; ++i) {
    auto p = mrg(e[x][i], e[y][i]);
    ret += p.second;
    e[k][i] = p.first;
  }
  return make_pair(k, ret);
}
void dfs2(int x) {
  int c = 0;
  for (int i = 0; i < 26; ++i)
    if (e[x][i]) {
      ++c;
    }
  int tmp = 0;
  cnt = n;
  int k = 0;
  for (int i = 0; i < 26; ++i)
    if (e[x][i]) {
      auto p = mrg(k, e[x][i]);
      tmp += p.second;
      k = p.first;
    }
  tmp += c;
  dd[x] = tmp;
  for (int i = 0; i < 26; ++i)
    if (e[x][i]) {
      dfs2(e[x][i]);
    }
}
int main() {
  scanf("%d", &n);
  for (int i = 1; i < n; ++i) {
    char s[10];
    scanf("%d%d%s", u + i, v + i, s);
    x[i] = s[0];
    e[u[i]][x[i] - 'a'] = v[i];
  }
  dfs(1, 0);
  dfs2(1);
  int mxdep = 0;
  for (int i = 1; i <= n; ++i) {
    mxdep = max(dep[i], mxdep);
    del[dep[i]] += dd[i];
  }
  int who = 0;
  for (int i = 0; i <= mxdep; ++i)
    if (del[who] < del[i]) who = i;
  printf("%d\n%d\n", n - del[who], who + 1);
  return 0;
}
