#include <bits/stdc++.h>
using namespace std;
using LL = long long;
using vi = vector<int>;
using pii = pair<int, int>;
using vpii = vector<pair<int, int>>;
using vll = vector<LL>;
using LD = long double;
template <typename T>
void check(T& a, const T& b) {
  if (a >= b) {
    a %= b;
  }
}
template <typename T>
T gcd(T u, T v) {
  if (u == v) return u;
  if (u == 0) return v;
  if (v == 0) return u;
  if (~u & 1) {
    if (v & 1)
      return gcd(u >> 1, v);
    else
      return gcd(u >> 1, v >> 1) << 1;
  }
  if (~v & 1) return gcd(u, v >> 1);
  if (u > v) return gcd((u - v) >> 1, v);
  return gcd((v - u) >> 1, u);
}
LL mulmod(LL a, LL b, const LL& m) {
  LL q = (LL)(((LD)a * (LD)b) / (LD)m);
  LL r = a * b - q * m;
  if (~~r > m) r %= m;
  if (r < 0) r += m;
  return r;
}
template <typename T, typename S>
T expo(T e, S n) {
  T x = 1, p = e;
  while (n) {
    if (n & 1) x = x * p;
    p = p * p;
    n >>= 1;
  }
  return x;
}
template <typename T>
T powerL(T e, T n, const T& m) {
  T x = 1, p = e;
  while (n) {
    if (n & 1) x = mulmod(x, p, m);
    p = mulmod(p, p, m);
    n >>= 1;
  }
  return x;
}
const int N = (int)3e5 + 10;
int n, sz[N], ans[N];
vector<vector<int>> g;
void dfs1(int u) {
  sz[u] = 1;
  for (auto& i : g[u]) {
    if (i != -1) {
      dfs1(i);
      sz[u] += sz[i];
    }
  }
}
int merge(int big, int u, vector<vi>& temp) {
  int cnt = 1;
  for (int i = 0; i < 26; i++) {
    int a = g[u][i];
    if (a != -1) {
      if (g[big][i] == -1) {
        temp.push_back({big, -1, i});
        g[big][i] = a;
      } else {
        cnt += merge(g[big][i], g[u][i], temp);
      }
    }
  }
  return cnt;
}
void dfs2(const int u, int dep) {
  vector<vi> level(26);
  int cnt = 0;
  for (int i = 0; i < 26; i++) {
    int a = g[u][i];
    if (a != -1) {
      cnt++;
      for (int j = 0; j < 26; j++) {
        int b = g[a][j];
        if (b != -1) level[j].push_back(b);
      }
    }
  }
  for (int i = 0; i < 26; i++) {
    if ((int)level[i].size() < 2) continue;
    int heavy = *(level[i].begin());
    vector<vi> temp;
    for (auto j : level[i]) {
      if (sz[heavy] < sz[j]) heavy = j;
    }
    for (auto j : level[i]) {
      if (j != heavy) cnt += merge(heavy, j, temp);
    }
    int x = (int)temp.size();
    for (int j = x - 1; j >= 0; j--) g[temp[j][0]][temp[j][2]] = temp[j][1];
  }
  ans[dep] += cnt;
  for (int j = 0; j < 26; j++) {
    int i = g[u][j];
    if (i != -1) {
      dfs2(i, dep + 1);
    }
  }
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cerr.tie(NULL);
  ;
  cin >> n;
  g.assign(n + 10, vector<int>(26, -1));
  memset(ans, 0, sizeof ans);
  for (int i = 1; i <= n - 1; i++) {
    int u, v;
    char x;
    cin >> u >> v >> x;
    u--;
    v--;
    g[u][x - 'a'] = v;
  }
  dfs1(0);
  dfs2(0, 0);
  int idx = 0;
  for (int i = 0; i < n; i++)
    if (ans[idx] < ans[i]) idx = i;
  cout << n - ans[idx] << '\n' << idx + 1 << '\n';
  return 0;
}
