#include <bits/stdc++.h>
#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][0]) a[queries[i][0]]--;
      if (queries[i][1] && !flag) {
        flag = true;
        if (queries[i][0]) xpeHb[queries[i][0]] = true;
      } else if (flag && queries[i][0])
        xpeHb[queries[i][0]] = true;
    }
    int min = 1e+9, ind = 0;
    for (int i = 1; i <= k; i++) {
      if (a[i] < min && !xpeHb[i]) {
        min = a[i];
        ind = i;
      }
    }
    int sum = 0, Sum = 0;
    flag = false;
    for (int i = 0; i < m - 1; i++) {
      if (queries[i][1] && !flag) flag = true;
      if (!queries[i][0]) {
        Sum++;
        if (!flag) sum++;
      }
    }
    for (int i = 1; i <= k; i++)
      printf(
          ((a[i] + a[ind] <= Sum || (a[i] <= sum && !xpeHb[i])) ? "Y" : "N"));
    printf("\n");
    memset(cnt, 0, (m + 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;
}
