#include "ezici.h"
#include <bits/stdc++.h>
using namespace std;
const string password = "e87d6a039dcd0c2c66437ed0def1339bf6ed5c5cabe0ab87fd0fc8511352acf8";
int main() {
    int t; cin >> t;
    if(t>=0) {
        int n=t,m; cin >> m;
        vector<pair<pair<int, int>, bool>> g;
        for(int i = 0; i < m; i++) {
            int u,v,t; cin >> u >> v >> t;
            g.push_back({{u,v}, t});
        }
        cout << password << " " << task1(n, m, g) << endl;
    }
    else if(t==-2) {
        int n; cin >> n;
        vector<long long> p;
        for(int i = 0; i < n-1; i++) {int a; cin >> a; p.push_back(a);}
        cout << password << " " << task2(p) << endl;
    }
    else if(t==-3) {
        int n; cin >> n;
        vector<long long> p;
        for(int i = 0; i < n; i++) {long long a; cin >> a; p.push_back(a);}
        cout << password << " " << task3(p) << endl;
    }
    else if(t==-4) {
        int n; cin >> n;
        vector<long long> p;
        for(int i = 0; i < n; i++) {long long a; cin >> a; p.push_back(a);}
        cout << password << " " << task4(p) << endl;
    }
    else if(t==-5) {
        int n; cin >> n;
        vector<long long> p;
        for(int i = 0; i < n; i++) {long long a; cin >> a; p.push_back(a);}
        cout << password << " " << task5(p) << endl;
    }
    else if(t==-6) {
        int n; cin >> n;
        vector<long long> p;
        for(int i = 0; i < n; i++) {long long a; cin >> a; p.push_back(a);}
        cout << password << " " << task6(p) << endl;
    }
    else if(t==-7) {
        int n; cin >> n;
        vector<long long> p;
        for(int i = 0; i < n; i++) {long long a; cin >> a; p.push_back(a);}
        cout << password << " " << task7(p) << endl;
    }
    else if(t==-8) {
        int n; cin >> n;
        vector<long long> p;
        for(int i = 0; i < n; i++) {long long a; cin >> a; p.push_back(a);}
        vector<long long> ans=task8(p);
        cout << password << " ";
        for(auto &x : ans) cout << x << " ";
        cout << endl;
    }
    else if(t==-9) {
        int n; cin >> n;
        vector<long long> p;
        for(int i = 0; i < n; i++) {long long a; cin >> a; p.push_back(a);}
        cout << password << " " << task9(p) << endl;
    }
    else if(t==-10) {
        int n; cin >> n;
        vector<long long> p;
        for(int i = 0; i < n; i++) {long long a; cin >> a; p.push_back(a);}
        cout << password << " " << task10(p) << endl;
    }
}