#include <bits/stdc++.h>
using namespace std;
const int N = 1e5 + 10;
int x[N];
int y[N];
int cnt[N];
bool can[N];
bool ans[N];
int main() {
  int tt;
  scanf("%d", &tt);
  while (tt--) {
    int m, k;
    scanf("%d %d", &m, &k);
    for (int i = 1; i <= k; ++i) {
      scanf("%d", cnt + i);
      can[i] = true;
      ans[i] = false;
    }
    for (int i = 0; i < m - 1; ++i) {
      scanf("%d %d", x + i, y + i);
    }
    bool found = false;
    int any = 0;
    for (int it = 0; it < m - 1; ++it) {
      if (!found && y[it] == 1) {
        for (int i = it; i < m - 1; ++i) {
          can[x[i]] = false;
        }
        int j = -1;
        for (int i = 1; i <= k; ++i) {
          if (can[i]) {
            if (any >= cnt[i]) {
              ans[i] = true;
              if (j == -1 || cnt[i] < cnt[j]) {
                j = i;
              }
            }
          }
        }
        any -= cnt[j];
        found = true;
      }
      if (x[it] != 0) {
        --cnt[x[it]];
      } else {
        ++any;
      }
    }
    for (int i = 1; i <= k; ++i) {
      putchar(ans[i] || any >= cnt[i] ? 'Y' : 'N');
    }
    putchar('\n');
  }
  return 0;
}
