#include #include #include #include #include #include using namespace std;const int MAXN=5e6+5;int nume,n,m;char s[55],fff[4][20]={" ","OK","WRONG","REPEAT"};struct node{ int cnt,child[26]; bool end,vis;}trie[MAXN];void ins(){ int u=0,len=strlen(s); for(int i=0;i '9'){ if(c=='-') fh=-1; c=getchar(); } while(c>='0'&&c<='9'){ rv=(rv<<1)+(rv<<3)+c-'0'; c=getchar(); } return fh*rv;}int main(){ freopen("in.txt","r",stdin); n=init(); for(int i=1;i<=n;i++) { scanf("%s",s); ins(); } m=init(); for(int i=1;i<=m;i++){ scanf("%s",s); printf("%s\n",fff[query()]); } fclose(stdin); return 0;}