import ru.ifmo.validate.*;

public class Validate implements Validator {
	@Override
	public void validate(ValidatingScanner in) {
		int n = in.nextInt("n", 1, Tests.N);
		int m = in.nextInt("m", 1, Tests.N);
		in.eoln();
		for (int i = 0; i < n; i++) {
			int from = in.nextInt("l[" + (i + 1) + "]", 1, Tests.MAX);
			int to = in.nextInt("r[" + (i + 1) + "]", 1, Tests.MAX);
			assert from <= to : "l[" + (i + 1) + "] > r[" + (i + 1)+ "]";
			in.nextInt("x[" + (i + 1) + "]", 1, Tests.N);
			in.eoln();
		}
		int q = 0;
		for (int i = 0; i < m; i++) {
			q = in.nextInt("q[" + (i + 1) + "]", q + 1, Tests.MAX);
			in.eoln();
		}
	}
}
