#include <bits/stdc++.h>
using namespace std;
const int INF = 2000000000;
const int MOD = 1000000007;
const int NMAX = 100005;
const int MMAX = 100005;
int main() {
  int i, t;
  scanf("%d", &t);
  for (int i = 1; i <= t; ++i) {
    int n, m, b, j, k, image = 0, real0 = 0, u, mini = 1000000000;
    static int real[NMAX];
    vector<int> used, otvet;
    static pair<int, int> a[NMAX];
    scanf("%d%d", &m, &k);
    used.assign(k + 1, 0);
    otvet.assign(k + 1, 0);
    for (j = 1; j <= k; ++j) {
      scanf("%d", &real[j]);
    }
    for (j = 1; j < m; ++j) {
      scanf("%d%d", &a[j].first, &a[j].second);
    }
    for (j = 1; j < m; ++j) {
      if ((a[j].second == 1) and (real0 == 0)) {
        for (u = j; u < m; ++u) {
          used[a[u].first] = 1;
        }
        for (u = 1; u <= k; ++u) {
          if ((used[u] == 0) and (real[u] <= image)) {
            otvet[u] = 1;
            if (real[u] < mini) {
              mini = real[u];
            }
          }
        }
        image = image - mini;
        real0 = 1;
      }
      if (a[j].first == 0) {
        image++;
      } else {
        real[a[j].first]--;
        if (real[a[j].first] == 0) {
          real0++;
        }
      }
    }
    for (j = 1; j <= k; ++j) {
      if ((real[j] - image <= 0) or (otvet[j] == 1)) {
        printf("Y");
      } else {
        printf("N");
      }
    }
    printf("\n");
  }
  return 0;
}
