#include <bits/stdc++.h>
using namespace std;
#pragma warning(disable : 4996)
int a[100010], cnt[100010];
int queries[100010][2];
bool res[100010];
bool xpeHb[100010];
int main() {
  int t;
  scanf("%d", &t);
  for (int y = 0; y < t; y++) {
    int m, k;
    scanf("%d %d", &m, &k);
    for (int i = 1; i <= k; i++) {
      scanf("%d", &a[i]);
    }
    int t, r;
    int count = 0;
    bool flag = false;
    for (int i = 0; i < m - 1; i++) {
      scanf("%d %d", &queries[i][0], &queries[i][1]);
      if (queries[i][1] == 1) flag = true;
      if (flag) {
        if (queries[i][0]) xpeHb[queries[i][0]] = true;
      }
    }
    flag = true;
    for (int i = 0; i < m - 1; i++) {
      t = queries[i][0];
      r = queries[i][1];
      if (r == 1 && flag) {
        flag = false;
        int max = 0;
        for (int j = 1; j <= k; j++) {
          if (cnt[j] + count >= a[j] && !xpeHb[j]) {
            res[j] = true;
            if (max < cnt[j] + count - a[j]) max = cnt[j] + count - a[j];
          }
        }
        count = max;
      }
      if (t == 0)
        count++;
      else {
        cnt[t]++;
      }
    }
    for (int j = 1; j <= k; j++) {
      if (cnt[j] + count >= a[j]) {
        res[j] = true;
      }
      if (res[j])
        printf("Y");
      else
        printf("N");
    }
    printf("\n");
    memset(cnt, 0, (k + 1) * 4);
    memset(res, 0, (k + 1) * 1);
    memset(a, 0, (k + 1) * 4);
    memset(xpeHb, 0, (k + 1) * 1);
    memset(queries[0], 0, (m + 1) * 4);
    memset(queries[1], 0, (m + 1) * 4);
  }
  return 0;
}
