[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]:
N=2002
mp=map from string to long long
likes=map from pair of long long, long long to long long
define the main function
    n=7, sz=0, m, a, b, c = long long
    read m
    while decremented value of m not equal 0
        l,r=string
        read l,r,r
        if mp[l] is 0 increment sz, mp[l] = sz
        if mp[r] is 0 increment sz, mp[r] = sz
        likes[make_pair(mp[l], mp[r])] = l
    end of the block
    read a,b,c
    pt=2187, minimal=a+b+c, ml=long long
    for i=0 to pt excluisve
        t=array of 3 vector of long long
        k=i, m1,m2,m3=long long, lks=0
        for i=1 to n inclusive
            add i at end of t[k modulo 3]
            divide k by 3
        end of the block
        it size of t[0] and size of t[1] and size of t[2]
            m1=a/size of t[0]
            m2=b/size of t[1]
            m3=c/size of t[2]
            m1=max(m1, max(m2,m3))-min(m1, min(m2,m3))
            for i=0 to 3 exclusive
                for j=0 to size of t[i] exclusive
                    for k=0 to size of t[i] exclusive add likes[make_pair(t[i][j], t[i][k])] to lks
            if minimal>m1
                minimal=m1
                ml=lks
            else if minimal is m1
                ml=max(ml,lks)
        end of the block
    end of the block
    print minimal, space, ml
end of the block

[CODE]:

const long long N = 2002;
map<string, long long> mp;
map<pair<long long, long long>, long long> likes;
int main() {
    long long n = 7, m, sz = 0, a, b, c;
    cin >> m;
    while (m--) {
        string l, r;
        cin >> l >> r >> r;
        if (mp[l] == 0) mp[l] = ++sz;
        if (mp[r] == 0) mp[r] = ++sz;
        likes[make_pair(mp[l], mp[r])] = 1;
    }
    cin >> a >> b >> c;
    long long pt = 2187, minimal = a + b + c, ml;
    for (long long i = 0; i < pt; i++) {
        vector<long long> t[3];
        long long k = i, m1, m2, m3, lks = 0;
        for (long long i = 1; i <= n; i++) {
            t[k % 3].push_back(i);
            k /= 3;
        }
        if (t[0].size() && t[1].size() && t[2].size()) {
            m1 = a / t[0].size();
            m2 = b / t[1].size();
            m3 = c / t[2].size();
            m1 = max(m1, max(m2, m3)) - min(m1, min(m2, m3));
            for (long long i = 0; i < 3; i++)
                for (long long j = 0; j < t[i].size(); j++)
                    for (long long k = 0; k < t[i].size(); k++) lks += likes[make_pair(t[i][j], t[i][k])];
            if (minimal > m1) {
                minimal = m1;
                ml = lks;
            } else if (minimal == m1)
                ml = max(ml, lks);
        }
    }
    cout << minimal << " " << ml << endl;
}