#include using namespace std; int main() { int N,k,S[100],grundy[10001],tag[10001],cookie=1; memset(tag,0,sizeof(tag)); while (1) { cin >> k; if (!k) break; for(int i=0;i> S[i]; for(int i=0,j;i<=10000;i++,cookie++) { for(j=0;j=0) tag[grundy[i-S[j]]]=cookie; for(j=0;tag[j]==cookie;j++); grundy[i]=j; } cin >> k; while (k--) { int h,j,mask=0; cin >> h; while (h--) { cin >> j; mask^=grundy[j]; } cout << (mask ? "W" : "L"); } cout << endl; } return 0; }