#include <bits/stdc++.h>
inline void swap(int &a, int &b) {
  int tmp;
  tmp = a;
  a = b;
  b = tmp;
}
inline int ABS(int a) { return a < 0 ? -a : a; }
using namespace std;
string mass[] = {"Anka",   "Chapay", "Cleo",       "Troll",
                 "Dracul", "Snowy",  "Hexadecimal"};
int n;
char s1[15], s2[15], s3[15];
int a[7][7];
int get(const string &q) {
  for (int i = 0; i != 7; i++)
    if (mass[i].compare(q) == 0) return i;
  return -1;
}
int gg1[7];
int mnCNT;
int q, w, e;
int mm[7];
int en = 0;
int answ2 = 0;
int qq[3] = {1, 1, 5};
int gg[3];
void rec(int nom) {
  if (nom == 7) {
    int tmp = 0;
    for (int i = 0; i != 7; i++) {
      for (int j = i + 1; j < 7; j++) {
        if (gg1[i] == gg1[j]) {
          tmp += a[i][j];
          tmp += a[j][i];
        }
      }
    }
    answ2 = (tmp > answ2 ? tmp : answ2);
  } else {
    for (int i = 0; i != 3; i++) {
      if (gg[i] < qq[i]) {
        gg1[nom] = i;
        gg[i]++;
        rec(nom + 1);
        gg[i]--;
      }
    }
  }
}
int main() {
  cin >> n;
  for (int i = 0; i != n; i++) {
    cin >> s1 >> s2 >> s3;
    a[get(s1)][get(s3)] = 1;
  }
  cin >> q >> w >> e;
  int mn = ABS(q - w);
  mn = (ABS(w - e / 5) > mn ? ABS(w - e / 5) : mn);
  mn = (ABS(q - e / 5) > mn ? ABS(q - e / 5) : mn);
  int z = 1;
  for (; z != 6; z++) {
    int ost = 7 - z;
    for (int zx = 1; zx != ost; zx++) {
      int zxc = 7 - zx - z;
      int dif1 = ABS(q / z - w / zx);
      int dif2 = ABS(q / z - e / zxc);
      int dif3 = ABS(w / zx - e / zxc);
      int tmp =
          (dif1 > (dif2 > dif3 ? dif2 : dif3) ? dif1
                                              : (dif2 > dif3 ? dif2 : dif3));
      if (tmp < mn) {
        mn = tmp;
        qq[0] = z;
        qq[1] = zx;
        qq[2] = zxc;
      }
    }
  }
  z = 1;
  for (; z != 6; z++) {
    int ost = 7 - z;
    for (int zx = 1; zx != ost; zx++) {
      int zxc = 7 - zx - z;
      int dif1 = ABS(q / z - w / zx);
      int dif2 = ABS(q / z - e / zxc);
      int dif3 = ABS(w / zx - e / zxc);
      int tmp =
          (dif1 > (dif2 > dif3 ? dif2 : dif3) ? dif1
                                              : (dif2 > dif3 ? dif2 : dif3));
      if (tmp == mn) {
        qq[0] = z;
        qq[1] = zx;
        qq[2] = zxc;
        rec(0);
      }
    }
  }
  cout << mn << ' ' << answ2 << endl;
  return 0;
}
