#include <bits/stdc++.h>
#pragma comment(linker, "/STACK:250000000")
using namespace std;
int food[100009], fun[100009];
int main() {
  ios_base::sync_with_stdio(false);
  int T;
  cin >> T;
  for (int t = 0; t < T; ++t) {
    int m, k;
    cin >> m >> k;
    vector<int> a(k), not_all(k), res(k);
    for (int i = 0; i < k; ++i) {
      cin >> a[i];
    }
    bool all_fun = true;
    int summ = 0;
    for (int i = 0; i < m - 1; ++i) {
      cin >> food[i] >> fun[i];
      food[i]--;
      if (all_fun && fun[i] == 1) {
        all_fun = false;
      }
      if (!all_fun && food[i] >= 0) {
        not_all[food[i]]++;
      }
    }
    all_fun = true;
    for (int i = 0; i < m - 1; ++i) {
      if (all_fun && fun[i] == 1) {
        all_fun = false;
        int minn = 2147483000;
        for (int j = 0; j < k; ++j) {
          if (not_all[j] == 0) {
            if (a[j] <= summ) {
              res[j] = 1;
            }
            minn = min(minn, a[j]);
          }
        }
        summ -= minn;
      }
      if (food[i] >= 0) {
        a[food[i]]--;
      } else {
        summ++;
      }
    }
    for (int j = 0; j < k; ++j) {
      if (res[j] == 1 || a[j] <= summ) {
        cout << 'Y';
      } else {
        cout << 'N';
      }
    }
    cout << "\n";
  }
  return 0;
}
