#include <bits/stdc++.h>
#pragma comment(linker, "/STACK:66777216")
#pragma hdrstop
using namespace std;
int main() {
  int tt;
  cin >> tt;
  for (int o = 0; o < tt; o++) {
    int m, k;
    cin >> m >> k;
    vector<int> a(k);
    vector<bool> b(k), d(k);
    b.assign(k, false);
    d.assign(k, true);
    for (int i = 0; i < k; i++) cin >> a[i];
    int c = 0;
    bool f = true;
    for (int i = 0; i < m - 1; i++) {
      int t, r;
      cin >> t >> r;
      t--;
      if ((r == 1) && (f)) {
        f = false;
        for (int j = 0; j < k; j++) {
          if (a[j] <= c) {
            b[j] = true;
          }
        }
      }
      if (t == -1) {
        c++;
      } else {
        if (!f) d[t] = false;
        b[t] = false;
        a[t]--;
      }
    }
    int mm = 1000000001;
    for (int i = 0; i < k; i++) {
      if (d[i]) {
        mm = min(mm, a[i]);
      }
    }
    if ((mm == 1000000001) || (f)) mm = 0;
    for (int i = 0; i < k; i++)
      if ((b[i]) || (a[i] + mm <= c)) {
        cout << "Y";
      } else
        cout << "N";
    cout << endl;
  }
  return 0;
}
