#include <bits/stdc++.h>
using namespace std;
const int H = 7, INF = 0x7fffffff;
int a, b, c, like[H][H], minDif, totLike;
string name[H] = {"Anka",   "Chapay", "Cleo",       "Troll",
                  "Dracul", "Snowy",  "Hexadecimal"};
map<string, int> n2i;
void solve() {
  int i[H], j, k, ta, tb, tc, tmpDif, tmpLike, exH, exL;
  minDif = INF;
  totLike = -INF;
  for (i[0] = 0; i[0] < 3; ++i[0])
    for (i[1] = 0; i[1] < 3; ++i[1])
      for (i[2] = 0; i[2] < 3; ++i[2])
        for (i[3] = 0; i[3] < 3; ++i[3])
          for (i[4] = 0; i[4] < 3; ++i[4])
            for (i[5] = 0; i[5] < 3; ++i[5])
              for (i[6] = 0; i[6] < 3; ++i[6]) {
                ta = tb = tc = 0;
                for (j = 0; j < H; ++j) {
                  if (i[j] == 0) {
                    ++ta;
                  } else if (i[j] == 1) {
                    ++tb;
                  } else {
                    ++tc;
                  }
                }
                if ((ta == 0) || (tb == 0) || (tc == 0)) {
                  continue;
                }
                tmpLike = 0;
                for (j = 0; j < H; ++j) {
                  for (k = 0; k < H; ++k) {
                    if ((j != k) && (i[j] == i[k]) && (like[j][k])) {
                      ++tmpLike;
                    }
                  }
                }
                exH = exL = a / ta;
                if ((exH) < (b / tb)) (exH) = (b / tb);
                if ((exH) < (c / tc)) (exH) = (c / tc);
                if ((exL) > (b / tb)) (exL) = (b / tb);
                if ((exL) > (c / tc)) (exL) = (c / tc);
                tmpDif = exH - exL;
                if ((minDif > tmpDif) ||
                    ((minDif == tmpDif) && (totLike < tmpLike))) {
                  minDif = tmpDif;
                  totLike = tmpLike;
                }
              }
}
int main() {
  int i;
  string p, q, sy;
  for (i = 0; i < H; ++i) {
    n2i[name[i]] = i;
  }
  while (cin >> i) {
    memset(like, 0, sizeof(like));
    while (i-- > 0) {
      cin >> p >> sy >> q;
      like[n2i[p]][n2i[q]] = 1;
    }
    cin >> a >> b >> c;
    solve();
    cout << minDif << " " << totLike << "\n";
  }
  return 0;
}
