#include <bits/stdc++.h>
#include "testlib.h"
#include <set>

using namespace std;

int MAX_V = 1'000'000;

int main(int argc, char *argv[]) {
    registerValidation(argc, argv);
    int group = stoi(validator.group());

    int n = inf.readInt(1, MAX_V, "n");
    inf.readSpace();
    int q = inf.readInt(1, MAX_V, "q");
    inf.readEoln();

    if (group == 1)
        ensuref(int64_t(n) * q < 10'000'000, "nq must be lower than 10'000'000");

    auto a = inf.readIntegers(n, 0, 1, "a");
    inf.readEoln();

    for (int _ = 0; _ < q; ++_) {
        int ti = inf.readInt(1, MAX_V, "ti");
        inf.readSpace();
        int tl = inf.readInt(1, MAX_V, "tl");
        inf.readSpace();
        int tr = inf.readInt(tl, MAX_V, "tr");
        inf.readEoln();

        ensuref(not (tl <= ti and ti <= tr), "ti must be not in [tl, tr]");
    }

    inf.readEof();
}