#include <iostream>
#include <algorithm>
//#include <string>
//#include <map>
#include <vector>
//#include <cmath>
//#include <cstdio>

using namespace std;

#define MAXHEAP 10001

int mex(vector<int> v) {
  sort(v.begin(), v.end());
  unique(v.begin(), v.end());

  for (int i = 0; i < v.size(); ++i)
    if (v[i] != i) return i;
  return v.size();
}

bool solve() {
  int Slen; cin >> Slen;
  if (Slen == 0) return false;

  vector<int> S;
  for (int i = 0; i < Slen; ++i) {
    int t; cin >> t; S.push_back(t);
  }

  vector<int> heapval;
  for (int i = 0; i < MAXHEAP; ++i) {
    vector<int> v;

    for (int j = 0; j < Slen; ++j)
      if (i-S[j] >= 0)
	v.push_back(heapval[i-S[j]]);

    heapval.push_back(mex(v));
  }

  int cases; cin >> cases;
  for (int i = 0; i < cases; ++i) {
    int heaps; cin >> heaps;

    int res = 0;
    for (int j = 0; j < heaps; ++j) {
      int t; cin >> t;  
      res ^= heapval[t];  
    }
    if (res) cout << 'W'; else cout << 'L';
  }

  cout << endl;
  return true;
}

int main() {
  while (solve());
  return 0;
}
