#include <bits/stdc++.h>
#include "game.h"

namespace GAME_ff7f6f029f098a79f537674800b8942e {
    const std::string secret_in = "be4219d4545f1868e9666e8fdafb49ce";
    const std::string secret_out = "6a3136c680ff9c25ad7ebddb5b5f7590";
    const std::string secret_wa = "737939fc097aa98024628a198ae0649e";
    std::ifstream fin("game.in");
    std::ofstream fout("game.out");
    void wrong() {
        fout << secret_wa << '\n';
        exit(0);
    }
    int main() {
        std::string s_in;
        fin >> s_in;
        if (s_in != secret_in) wrong();

        fout << secret_out << '\n';

        int c, t;
        fin >> c >> t;
        init(c, t);
        for (int i = 1; i <= t; i++) {
            int n, m, k;
            fin >> n >> m >> k;
            std::vector<int> a(n), b(n), t(n), w(n);
            for (int j = 0; j < n; j++) fin >> a[j] >> b[j] >> t[j] >> w[j];
            fout << game(n, m, k, a, b, t, w) << '\n';
        }

        fout << secret_out << '\n';
        return 0;
    }
}

signed main() {
    return GAME_ff7f6f029f098a79f537674800b8942e::main();
}
