func_code_string: #include <bits/stdc++.h>   using namespace std;   inline long long tmx(long long a, long long b, long long c) {     return (a > b && a > c) ? a : ((b > c) ? b : c);   }   inline long long tmn(long long a, long long b, long long c) {     return (a < b && a < c) ? a : ((b < c) ? b : c);   }   const int MXL = 0x3f3f3f3f;   string s[] = { Anka ,    Chapay ,  Cleo ,        Troll ,                  Dracul ,  Snowy ,   Hexadecimal };   inline int find(string x) {     for (int i = 0; i < 7; ++i)       if (s[i] == x) return i;   }   int n;   long long A, B, C;   int f[7][7] = {};   long long BE = (long long)MXL * MXL, AM = 0;   int c[7];   void dfs(int w) {     if (w == 7) {       int t[3] = {};       for (int i = 0; i < 7; ++i) ++t[c[i]];       if (!t[0] || !t[1] || !t[2]) return;       long long MX = tmx(A / t[0], B / t[1], C / t[2]);       long long MN = tmn(A / t[0], B / t[1], C / t[2]);       long long BE_N = MX - MN;       if (BE_N > BE) return;       long long AM_N = 0;       for (int i = 0; i < 7; ++i)         for (int j = 0; j < 7; ++j)           if (c[i] == c[j]) AM_N += f[i][j];       if (BE_N < BE || AM_N > AM) {         BE = BE_N;         AM = AM_N;       }       return;     }     for (int i = 0; i < 3; ++i) {       c[w] = i;       dfs(w + 1);     }   }   string L, R;   int LN, RN;   string like;   inline void EXEC() {     cin >> n;     for (int i = 0; i < n; ++i) {       cin >> L >> like >> R;       LN = find(L);       RN = find(R);       ++f[LN][RN];     }     cin >> A >> B >> C;     dfs(0);     cout << BE <<     << AM << endl;   }   int main() {     EXEC();     return 0;   }   