#include <bits/stdc++.h>
using namespace std;
#pragma warning(disable : 4996)
int a[100001], b[100001];
int main() {
  int T;
  scanf("%d", &T);
  while (T--) {
    int m, k;
    scanf("%d%d", &m, &k);
    for (int i = 1; i <= k; i++) scanf("%d", &a[i]);
    int sum = 0, bsum = -1;
    while (--m) {
      int t, r;
      scanf("%d%d", &t, &r);
      if (r && bsum == -1) {
        bsum = sum;
        memcpy(b, a, sizeof a);
      }
      if (t)
        a[t]--;
      else
        sum++;
    }
    int mi = 100001;
    for (int i = 1; i <= k; i++)
      if (a[i] == b[i]) mi = min(mi, a[i]);
    for (int i = 1; i <= k; i++)
      if (bsum == -1 && sum >= a[i])
        printf("Y");
      else if (bsum == -1)
        printf("N");
      else if (a[i] == b[i] && bsum >= b[i])
        printf("Y");
      else if (sum - mi >= a[i])
        printf("Y");
      else
        printf("N");
    puts("");
  }
  return 0;
}
