[TASK]:
You will be given lines of pseudocode, your task is to write the corresponding C++ code. The pseudocode will provide detailed description of the c++ code line by line. The pseudocode is garanteed to be correct and complete.

[INSTRUCTION]:
The following libraries are already included in the code.
```cpp
#include <cstdio>
#include <iostream>
#include <vector>
#include <algorithm>
#include <numeric>
#include <cmath>
#include <cstring>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <list>
#include <fstream>
#include <climits>
#include <cassert>
#include <iomanip>
#include <sstream>
#include <bitset>
using namespace std;
```
Do not include them in your code again. Please surround your code with ```cpp and ``` markers. Note that the code should correspond to the pseudocode line by line.

[PSEUDOCODE]:
vec = int vector array of size 3
like = string and int map
diff, ans, a, b, c = int and mat = two dimensional int array of sizes 10 and 10
in function cal returning an int
    sum, i, j, k = int with sum = 0
    for i = 0 to 3
        for j = 0 to size of vec[i]
            for k = 0 to size of vec[i] increment sum by mat[vec[i][j]][vec[i][k]]
    end of the block
    return sum
end of the block
in function count taking an int now
    if now is 7
        if size of vec[0] and size of vec[1] and size of vec[2] are all not 0
            x = int array with the values a / size of vec[0], b / size of vec[1] and c / size of vec[2]
            sort x
            if x[2] - x[0] is less than diff
                set diff to x[2] - x[0]
                set ans to cal
            else if x[2] - x[0] is diff
                set ans to max of ans and cal
        end of the block
        return
    end of the block
    for i = 0 to 3
        append now to vec[i]
        call count of now + 1
        remove last value of vec[i]
    end of the block
end of the block
define the main function
    set like["Anka"] to 0
    set like["Chapay"] to 1
    set like["Cleo"] to 2
    set like["Troll"] to 3
    set like["Dracul"] to 4
    set like["Snowy"] to 5
    set like["Hexadecimal"] to 6
    n, i = int
    name1, str, name2 = string
    loop while reading n
        set diff to (1 bitshift right by 31) - 1
        for i = 0 to 3 clear vec[i]
        set all values of mat to 0
        for i = 0 to n
            read name1 then str then name2
            increment mat[like[name1]][like[name2]]
        end of the block
        read a then b then c
        call count of 0
        print diff and ans
    end of the block
end of the block

[CODE]:

vector<int> vec[3];
map<string, int> like;
int diff, mat[10][10], ans, a, b, c;
int cal() {
    int sum = 0, i, j, k;
    for (i = 0; i < 3; i++) {
        for (j = 0; j < vec[i].size(); j++)
            for (k = 0; k < vec[i].size(); k++) sum += mat[vec[i][j]][vec[i][k]];
    }
    return sum;
}
void count(int now) {
    if (now == 7) {
        if (vec[0].size() && vec[1].size() && vec[2].size()) {
            int x[] = {a / vec[0].size(), b / vec[1].size(), c / vec[2].size()};
            sort(x, x + 3);
            if (x[2] - x[0] < diff) {
                diff = x[2] - x[0];
                ans = cal();
            } else if (x[2] - x[0] == diff)
                ans = max(ans, cal());
        }
        return;
    }
    for (int i = 0; i < 3; i++) {
        vec[i].push_back(now);
        count(now + 1);
        vec[i].pop_back();
    }
}
int main() {
    like["Anka"] = 0;
    like["Chapay"] = 1;
    like["Cleo"] = 2;
    like["Troll"] = 3;
    like["Dracul"] = 4;
    like["Snowy"] = 5;
    like["Hexadecimal"] = 6;
    int n, i;
    string name1, str, name2;
    while (cin >> n) {
        diff = (1 << 31) - 1;
        for (i = 0; i < 3; i++) vec[i].clear();
        memset(mat, 0, sizeof(mat));
        for (i = 0; i < n; i++) {
            cin >> name1 >> str >> name2;
            mat[like[name1]][like[name2]]++;
        }
        cin >> a >> b >> c;
        count(0);
        cout << diff << " " << ans << endl;
    }
}