#include <bits/stdc++.h>
using namespace std;
void io() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  cout.precision(15);
}
const int MAXN = 3e5 + 2;
int n, u, v;
int go[MAXN][26];
int subsz[MAXN];
int depth[MAXN];
int big[MAXN];
void dfs(int u, int p) {
  depth[u] = depth[p] + 1;
  subsz[u] = 1;
  for (int i = 0; i < 26; i++) {
    if (go[u][i]) {
      int v = go[u][i];
      dfs(v, u);
      subsz[u] += subsz[v];
      if (subsz[v] > subsz[big[u]]) {
        big[u] = v;
      }
    }
  }
}
int ans[MAXN];
int copy_par[MAXN];
int find_overlap(int u, int v) {
  int ret = 0;
  for (int i = 0; i < 26; i++) {
    if (go[v][i]) {
      if (go[u][i]) {
        ret = ret + 1 + find_overlap(go[u][i], go[v][i]);
      } else {
        go[u][i] = go[v][i];
        copy_par[go[u][i]] = u;
      }
    }
  }
  return ret;
}
void fix(int u) {
  for (int i = 0; i < 26; i++) {
    if (go[u][i]) {
      if (copy_par[go[u][i]]) go[copy_par[go[u][i]]][i] = 0;
    }
  }
  for (int i = 0; i < 26; i++) {
    if (go[u][i]) {
      fix(go[u][i]);
    }
  }
}
void dfs_merge(int u) {
  int children = 0;
  for (int i = 0; i < 26; i++) {
    if (go[u][i]) {
      children++;
    }
  }
  ans[depth[u]] += children;
  for (int i = 0; i < 26; i++) {
    if (go[u][i] && go[u][i] != big[u]) {
      ans[depth[u]] += find_overlap(big[u], go[u][i]);
    }
  }
  for (int i = 0; i < 26; i++) {
    if (go[u][i] && go[u][i] != big[u]) {
      fix(go[u][i]);
    }
  }
  for (int i = 0; i < 26; i++) {
    if (go[u][i]) dfs_merge(go[u][i]);
  }
}
int main(int argc, char* argv[]) {
  io();
  cin >> n;
  char x;
  for (int i = 1; i < n; i++) {
    cin >> u >> v >> x;
    go[u][x - 'a'] = v;
  }
  dfs(1, 0);
  dfs_merge(1);
  int p = 0;
  int max_rem = 0;
  for (int i = 1; i <= n; i++) {
    if (max_rem < ans[i]) {
      max_rem = ans[i];
      p = i;
    }
  }
  printf("%d\n%d\n", (n - max_rem), p);
  return 0;
}
