[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]:
declare long longs ml = 0 and md = 10e10
create vector of ints team with 7 elements filled with 0
create map of string to int called hashi
create map of int/int pairs to bool called likes
create vector of long long called xp with 3 elements
tri is a void function with int argument i
    if i is equal to 7
        create long longs mie = 10e10 and mae and lik = 0
        create bool can = true
        for integer j = 0 to 3 exclusive
            create long long co = 0
            loop k from 0 to 7 exclusive
                if team[k] is equal to j
                    increment co
                    for l = 0 to 7 exclusive
                        if team[l] = j and likes[pair<int, int>(k, l)] is true, increment lik by one
                    end of the block
                end of the block
            end of the block
            if co is equal to 0
                assign false to can
                break
            end of the block
            change mie to min of mie and xp[j] / co
            change mae to max of mae and xp[j] / co
        end of the block
        if can is true
            create long long dif = mae - mie
            if dif = md
                set ml to max of lik and ml
            else if dif < md
                assign dif to md
                assign lik to ml
            end of the block
        end of the block
    else
        for integer j = 0 to 3 exclusive
            set team[i] to j
            call tri(i + 1)
        end of the block
    end of the block
    return
end of the block
define the main function
    declare int variable n
    read input to n
    assign 0 to hashi["Trolong long"]
    assign 1 to hashi["Dracul"]
    assign 2 to hashi["Anka"]
    assign 3 to hashi["Snowy"]
    assign 4 to hashi["Hexadecimal"]
    assign 5 to hashi["Chapay"]
    assign 6 to hashi["Cleo"]
    loop, decrementing n, while it is not 0
        create strings p and q
        read input to p, q and q
        set likes[pair<int, int>(hashi[p], hashi[q])] to true
    end of the block
    loop i from 0 to 3 exclusive, read xp[i]
    call tri(0)
    print md, " ", ml and "\n"
    return to indicate successful execution
end of the block

[CODE]:

long long md = 10e10, ml = 0;
vector<int> team(7, 0);
map<string, int> hashi;
map<pair<int, int>, bool> likes;
vector<long long> xp(3);
void tri(int i) {
    if (i == 7) {
        long long mie = 10e10, mae = 0, lik = 0;
        bool can = true;
        for (int j = 0; j < 3; j++) {
            long long co = 0;
            for (int k = 0; k < 7; k++) {
                if (team[k] == j) {
                    co++;
                    for (int l = 0; l < 7; l++) {
                        if (team[l] == j && likes[pair<int, int>(k, l)]) { lik++; }
                    }
                }
            }
            if (co == 0) {
                can = false;
                break;
            }
            mie = min(mie, xp[j] / co);
            mae = max(mae, xp[j] / co);
        }
        if (can) {
            long long dif = mae - mie;
            if (dif == md)
                ml = max(lik, ml);
            else if (dif < md) {
                md = dif;
                ml = lik;
            }
        }
    } else {
        for (int j = 0; j < 3; j++) {
            team[i] = j;
            tri(i + 1);
        }
    }
    return;
}
int main() {
    int n;
    cin >> n;
    hashi["Trolong long"] = 0;
    hashi["Dracul"] = 1;
    hashi["Anka"] = 2;
    hashi["Snowy"] = 3;
    hashi["Hexadecimal"] = 4;
    hashi["Chapay"] = 5;
    hashi["Cleo"] = 6;
    while (n--) {
        string p, q;
        cin >> p >> q >> q;
        likes[pair<int, int>(hashi[p], hashi[q])] = true;
    }
    for (int i = 0; i < 3; i++) cin >> xp[i];
    tri(0);
    cout << md << " " << ml << "\n";
    return 0;
}