#include <bits/stdc++.h>
using namespace std;
int a[100100], ans[100100], m, k, t, j, i, flag, x[100100], y[100100], mi, g;
int main() {
  scanf("%d", &t);
  for (j = 0; j < t; j++) {
    a[0] = 0;
    flag = 1;
    mi = 1000000000;
    scanf("%d", &m);
    scanf("%d", &k);
    for (i = 1; i <= k; i++) scanf("%d", a + i);
    for (i = 1; i <= k; i++) ans[i] = 1;
    for (i = 1; i < m; i++) {
      scanf("%d", x + i);
      scanf("%d", y + i);
    }
    for (i = 1; i < m; i++) {
      if ((y[i] == 0) || (flag == 0)) {
        a[x[i]]--;
        if (x[i] == 0) a[0] += 2;
        continue;
      }
      flag = 0;
      for (g = i; g < m; g++) ans[x[g]] = 0;
      for (g = 1; g <= k; g++) {
        if (a[g] > a[0]) ans[g] = 0;
      }
      for (g = 1; g <= k; g++) {
        if (ans[g] == 1) mi = min(mi, a[g]);
      }
      a[0] -= mi;
      a[x[i]]--;
      if (x[i] == 0) a[0] += 2;
    }
    for (i = 1; i <= k; i++) {
      if ((ans[i] == 1) && (flag == 0))
        printf("Y");
      else if (a[0] >= a[i])
        printf("Y");
      else
        printf("N");
    }
    printf("\n");
  }
  return 0;
}
