#include <bits/stdc++.h>
using namespace std;
int main() {
  int T;
  cin >> T;
  while (T-- > 0) {
    int m, k;
    cin >> m >> k;
    m--;
    vector<int> b(k), bNext(k), used(k, 0);
    vector<pair<int, int> > chel(m);
    int flag = 0;
    for (int i = 0; i < k; i++) {
      cin >> b[i];
    }
    for (int i = 0; i < m; i++) {
      cin >> chel[i].first >> chel[i].second;
      if (chel[i].first > 0) bNext[chel[i].first - 1]++;
    }
    int neopr = 0;
    for (int i = 0; i < m; i++) {
      if (chel[i].second == 1 && flag == 0) {
        flag = 1;
        int mi = 100500;
        int ind = 0;
        for (int j = 0; j < k; j++) {
          if (bNext[j]) continue;
          if (b[j] <= neopr) used[j] = 1;
          if (b[j] < mi) {
            mi = b[j];
            ind = j;
          }
        }
        neopr -= mi;
      }
      if (chel[i].first == 0)
        neopr++;
      else {
        b[chel[i].first - 1]--;
        bNext[chel[i].first - 1]--;
      }
    }
    for (int i = 0; i < k; i++) {
      if (used[i] == 1) {
        cout << 'Y';
        continue;
      }
      if (b[i] - neopr <= 0) {
        cout << 'Y';
        continue;
      }
      cout << 'N';
    }
    cout << endl;
  }
  return 0;
}
