#include <bits/stdc++.h>
using namespace std;
const int N = 3e5, NN = N + N;
int n, cur, level;
int trie[NN + 5][26];
int sz[N + 1];
int reduce[N + 1];
int idx;
void init() {
  fill_n(&trie[0][0], (NN + 5) * 26, 0);
  fill_n(sz, N + 1, 0);
  fill_n(reduce, N + 1, 0);
}
void remove(int u) {
  for (int i = 0, _stop = 25; i <= _stop; i++) {
    if (trie[u][i]) {
      remove(trie[u][i]);
      trie[u][i] = 0;
    }
  }
}
void count(int u, int pos) {
  for (int i = 0, _stop = 25; i <= _stop; i++) {
    if (trie[pos][i] != 0 && trie[u][i] != 0) {
      reduce[level]++;
      count(trie[u][i], trie[pos][i]);
    }
  }
}
void add(int u, int pos) {
  for (int i = 0, _stop = 25; i <= _stop; i++) {
    if (trie[u][i]) {
      if (trie[pos][i] == 0) {
        trie[pos][i] = idx++;
      } else {
        ;
        reduce[level]++;
      }
      add(trie[u][i], trie[pos][i]);
    }
  }
}
bool cmpr(int a, int b) { return sz[trie[cur][a]] < sz[trie[cur][b]]; }
void dfs(int u, int l) {
  sz[u] = 1;
  ;
  for (int i = 0, _stop = 25; i <= _stop; i++) {
    if (trie[u][i]) {
      dfs(trie[u][i], l + 1);
      sz[u] += sz[trie[u][i]];
    }
  };
  vector<int> e;
  for (int i = 0, _stop = 25; i <= _stop; i++) {
    if (trie[u][i]) {
      e.push_back(i);
    }
  }
  reduce[l] += e.size();
  if (e.size() <= 1) {
    ;
    return;
  }
  cur = u;
  level = l;
  sort(e.begin(), e.end(), cmpr);
  ;
  idx = N + 2;
  for (int i = 0, _stop = e.size() - 2; i <= _stop; i++) {
    add(trie[u][e[i]], N + 1);
  }
  count(trie[u][e.back()], N + 1);
  remove(N + 1);
  ;
}
int main() {
  ;
  ios::sync_with_stdio(false);
  cin.tie(NULL);
  {
    init();
    cin >> n;
    for (int i = 1, _stop = n - 1; i <= _stop; i++) {
      int u, v;
      char ch;
      cin >> u >> v >> ch;
      trie[u][ch - 'a'] = v;
    }
    dfs(1, 1);
    ;
    int max_id, max_val = 0;
    for (int i = 1, _stop = n; i <= _stop; i++) {
      if (reduce[i] > max_val) {
        max_val = reduce[i];
        max_id = i;
      }
    }
    cout << n - max_val << '\n' << max_id << '\n';
  };
  return 0;
}
