#include <bits/stdc++.h>
using namespace std;
void solve() {
  int n, m;
  cin >> n >> m;
  vector<int> ct(m);
  for (auto& i : ct) {
    cin >> i;
  }
  vector<bool> canBeFirst(m, false);
  vector<int> cntWhenDisappointed(m, 0);
  bool disappointed = false;
  int unknown = 0;
  for (int i = 0; i < n - 1; i++) {
    int f, d;
    cin >> f >> d;
    f--;
    if (!disappointed && d == 1) {
      for (int i = 0; i < m; i++) {
        if (ct[i] <= unknown) {
          canBeFirst[i] = true;
        }
        cntWhenDisappointed[i] = ct[i];
      }
      disappointed = true;
    }
    if (f == -1) {
      unknown++;
    } else {
      ct[f]--;
      canBeFirst[f] = false;
    }
  }
  int minFirst = 0;
  if (disappointed) {
    minFirst = n;
    for (int i = 0; i < m; i++) {
      if (canBeFirst[i]) {
        minFirst = min(minFirst, cntWhenDisappointed[i]);
      }
    }
  }
  for (int i = 0; i < m; i++) {
    if (ct[i] <= unknown - minFirst || canBeFirst[i]) {
      cout << "Y";
    } else {
      cout << "N";
    }
  }
  cout << endl;
}
int main() {
  int cases;
  cin >> cases;
  while (cases--) {
    solve();
  }
}
