#include "testlib.h"
#include <bits/stdc++.h>
using namespace std;

vector<int> read_1b_vector(int len) {
	auto ret = inf.readInts(len);
	ret.insert(ret.begin(), 0);
	return ret;
}

// YES -> true ; NO -> false
inline bool check_output(
	InStream &in,
	const int N,
	const vector<int> &A,
	const vector<int> &B
) {
	// Read "YES" or "NO".
	{
		const string token = in.readToken("[A-Z]{2,3}", "token");
		if ("NO" == token) {
			return false;
		}
		if ("YES" != token) {
			in.quitf(_wa, "Invalid token: %s", token.c_str());
		}
	}

	const int Q = in.readInt(0, N * N, "Q");

	auto X = A;

	for (int q = 1; q <= Q; q++) {
		const int typ = in.readInt(1, 2, "type_" + to_string(q));
		const int pos = in.readInt(1, int(X.size()) - 2, "pos_" + to_string(q));

		if (1 == typ) {
			in.quitif(!(X[pos] < X[pos + 1]), _wa, "Invalid swap");
			swap(X[pos], X[pos + 1]);
		} else if (2 == typ) {
			X[pos] = min(X[pos], X[pos + 1]);
			X.erase(X.begin() + pos + 1);
		}
	}

	in.quitif(X != B, _wa, "Failed to make B");
	return true;
};

int main(int argc, char* argv[]) {
	registerTestlibCmd(argc, argv);

	const int N = inf.readInt();
	const int M = inf.readInt();

	const vector<int> A = read_1b_vector(N);
	const vector<int> B = read_1b_vector(M);

	const bool myAns = check_output(ans, N, A, B);
	const bool yourAns = check_output(ouf, N, A, B);

	if (myAns != yourAns) {
		if (myAns) {
			// Jury found but you did not.
			quitf(_wa, "Wrong Answer");
		}

		// Jury could not find but you did.
		quitf(_fail, "Your output is better than Jury's");
	}

	quitf(_ok, "Correct");
}
