#include <bits/stdc++.h>
using namespace std;
const double eps = 1e-6;
int const mod = 1e9 + 7;
int const INF = 1 << 29;
int main() {
  int t;
  scanf("%d", &t);
  while (t--) {
    int m, k;
    scanf("%d %d", &m, &k);
    int a[k + 1], Q[m + 1][2], pos[k + 1], cnt[k + 1];
    memset(cnt, 0, sizeof cnt);
    for (int i = 1; i <= k; ++i) scanf("%d", &a[i]), pos[i] = 1;
    for (int i = 1; i < m; ++i) {
      scanf("%d %d", &Q[i][0], &Q[i][1]);
      pos[Q[i][0]] = i + 1;
    }
    int pp = 0;
    int zero = 0;
    for (int i = 1; i < m; ++i) {
      if (Q[i][1]) {
        pp = i;
        break;
      }
      (Q[i][0]) ? ++cnt[Q[i][0]] : ++zero;
    }
    if (pp) {
      int mn = INF;
      for (int i = 1; i <= k; ++i) {
        int val = cnt[i] + zero;
        if (a[i] <= val && pos[i] <= pp) {
          int consume = a[i] - cnt[i];
          if (consume < mn) {
            mn = consume;
          }
          a[i] = 0;
        }
      }
      zero -= mn;
      for (int i = pp; i < m; ++i) {
        (Q[i][0]) ? ++cnt[Q[i][0]] : ++zero;
      }
    }
    for (int i = 1; i <= k; ++i) {
      int val = cnt[i] + zero;
      putchar((a[i] <= val) ? 'Y' : 'N');
    }
    putchar('\n');
  }
  return 0;
}
