#include <iostream>
#include <cstdio>
#include <vector>
using namespace std;
int d1[100007];
int d2[100007];
int main() {
	ios_base::sync_with_stdio(0);
	int tt;
	cin >> tt;
	while(tt--) {
		int n, m;
		cin >> n >> m;	
		for(int i = 1; i <= n; ++i) d1[i] = d2[i] = 0;
		for(int i = 1; i <= m; ++i) {
			int x, y;
			char z;
			cin >> x >> z >> y;
			if(z == '>') d1[y]++;
			else d2[y]++;
		}
		
		bool przeg = 1;
		for(int i = 1; i <= n; ++i) if(d2[i] == 0) przeg = 0;
		if(przeg) cout << "PRZEGRANA\n";
		else {
			bool wyg = 0;
			for(int i = 1; i <= n; ++i) if(d1[i] == n) wyg = 1;
			if(wyg) cout << "WYGRANA\n";
			else cout << "REMIS\n";
		}
	}
	return 0;
}
        | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 | #include <iostream> #include <cstdio> #include <vector> using namespace std; int d1[100007]; int d2[100007]; int main() { ios_base::sync_with_stdio(0); int tt; cin >> tt; while(tt--) { int n, m; cin >> n >> m; for(int i = 1; i <= n; ++i) d1[i] = d2[i] = 0; for(int i = 1; i <= m; ++i) { int x, y; char z; cin >> x >> z >> y; if(z == '>') d1[y]++; else d2[y]++; } bool przeg = 1; for(int i = 1; i <= n; ++i) if(d2[i] == 0) przeg = 0; if(przeg) cout << "PRZEGRANA\n"; else { bool wyg = 0; for(int i = 1; i <= n; ++i) if(d1[i] == n) wyg = 1; if(wyg) cout << "WYGRANA\n"; else cout << "REMIS\n"; } } return 0; } | 
 
            
         English
                    English