#include<iostream> #include<cstring> #include<cstdio> #include<cmath> #include<algorithm> #include<cstdlib> #include<map> #include<queue> #include <deque> #include <list> #include <ctime> #include <stack> #include <vector> #include<set> #define N 1010 #define MOD typedef long long ll; #define FOR(i,j,n) for(int i=j;i<=n;i++) #define DFR(i,j,k) for(int i=j;i>=k;--i) #define lowbit(a) a&-a const int inf = 0x3f3f3f3f; const double pi = acos(-1.0); using namespace std; #define pr(x) cout << #x << " = " << x << " " #define prln(x) cout << #x << " = " << x << endl int n, q; int sz, ls[N], rs[N], val[N]; int newNode(int x) { ++sz; ls[sz] = rs[sz] = 0; val[sz] = x; return sz; } int insert(int rt, int x) { if(!val[rt]) return newNode(x); if(x < val[rt]) ls[rt] = insert(ls[rt], x); else rs[rt] = insert(rs[rt], x); return rt; } void dfs(int rt, int x) { if(x < val[rt]) { putchar('E'); dfs(ls[rt], x); } else if(x > val[rt]) { putchar('W'); dfs(rs[rt], x); } } int main() { int t; scanf("%d", &t); while(t--) { scanf("%d", &n); sz = 0; memset(val, 0, sizeof val); FOR(i,1,n) { int x; scanf("%d", &x); insert(1, x); } scanf("%d", &q); while(q--) { int x;scanf("%d", &x); dfs(1, x); puts(""); } } return 0; }