#define HIDE_CHECKER_OUTPUT
#include "testlib.h"

#include <string>
#include <set>
using namespace std;

multiset<multiset<string>> readAns(InStream &in, int n) {
	multiset<multiset<string>> res;
	int k = in.readInt(1, n);
	for (int i = 0; i < k; ++i) {
		multiset<string> grp;
		int m = in.readInt(1, n);
		for (int j = 0; j < m; ++j) {
			grp.insert(in.readToken());
		}
		res.insert(grp);
	}
	return res;
}

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

	int n = inf.readInt();
	auto j = readAns(ans, n);
	auto p = readAns(ouf, n);
	if (j != p) {
		quitf(_wa, "translate:wrong");
	}
	quitf(_ok, "translate:success");
}
