#include <bits/stdc++.h>
using namespace std;
int main() {
  string her[] = {"Anka",   "Chapay", "Cleo",       "Troll",
                  "Dracul", "Snowy",  "Hexadecimal"};
  int n;
  while (cin >> n) {
    vector<vector<bool> > g(7, vector<bool>(7, 0));
    for (int i = 0; i < n; i++) {
      string a, b, l;
      cin >> a >> l >> b;
      g[find(her, her + 7, a) - her][find(her, her + 7, b) - her] = 1;
    }
    int a, b, c;
    cin >> a >> b >> c;
    vector<int> tmp(7);
    for (int i = 0; i < 7; i++) tmp[i] = i;
    vector<pair<int, int> > res;
    do {
      for (int i = 1; i < 7; i++) {
        for (int j = 1; j < 7; j++) {
          int k = 7 - (i + j);
          if (k < 1) break;
          int lik = 0;
          for (int z = 0; z < i; z++) {
            for (int zz = z + 1; zz < i; zz++)
              lik += g[tmp[z]][tmp[zz]] + g[tmp[zz]][tmp[z]];
          }
          for (int z = i; z < i + j; z++) {
            for (int zz = z + 1; zz < i + j; zz++)
              lik += g[tmp[z]][tmp[zz]] + g[tmp[zz]][tmp[z]];
          }
          for (int z = i + j; z < 7; z++) {
            for (int zz = z + 1; zz < 7; zz++)
              lik += g[tmp[z]][tmp[zz]] + g[tmp[zz]][tmp[z]];
          }
          res.push_back(
              {max(a / i, max(b / j, c / k)) - min(a / i, min(b / j, c / k)),
               -lik});
        }
      }
    } while (next_permutation(tmp.begin(), tmp.end()));
    sort(res.begin(), res.end());
    cout << res[0].first << ' ' << -res[0].second << endl;
  }
  return 0;
}
