/* Sample solution to Nim
 * Author: Jimmy Mårdell
 *
 * Method: Grundy numbers
 */

import java.io.*;
import java.util.*;

public class nim_jm
{
    public static void main(String[] args) throws Exception {
		BufferedReader stdin = new BufferedReader(new InputStreamReader(System.in));
		PrintWriter stdout = new PrintWriter(new BufferedWriter(new OutputStreamWriter(System.out)));

		int cookie=1;
		int S[]=new int[100], grundy[]=new int[10001], tag[]=new int[10001];
		for(int i=0;i<10001;i++) tag[i]=0;

		while (true) {
			StringTokenizer st = new StringTokenizer(stdin.readLine());
			int k = Integer.parseInt(st.nextToken());
			if (k==0) break;
			for(int i=0;i<k;i++) S[i]=Integer.parseInt(st.nextToken());
			for(int i=0,j;i<=10000;i++,cookie++) {
				for(j=0;j<k;j++)
					if (i-S[j]>=0) tag[grundy[i-S[j]]]=cookie;
				for(j=0;tag[j]==cookie;j++);
				grundy[i]=j;
			}
			k = Integer.parseInt(new StringTokenizer(stdin.readLine()).nextToken());
			while (k-->0) {
				st = new StringTokenizer(stdin.readLine());
				int h=Integer.parseInt(st.nextToken()),j,mask=0;
				while (h-->0) mask^=grundy[Integer.parseInt(st.nextToken())];
				if (mask>0) stdout.print("W"); else stdout.print("L");
			}
			stdout.println();
		}
		stdout.close();
    }
}
