#include <bits/stdc++.h>
using namespace std;
void solve();
int main(int argc, char** argv) {
  size_t t;
  cin >> t;
  for (size_t taskNum = 0; taskNum < t; ++taskNum) solve();
  return 0;
}
void solve() {
  size_t m, k;
  cin >> m >> k;
  vector<int> a(k);
  vector<size_t> lastEnters(k, 0);
  vector<pair<int, int> > data(m - 1);
  for (size_t dishNum = 0; dishNum < k; ++dishNum) cin >> a[dishNum];
  int capacity = 0;
  int t, r;
  int minRest = 1000000;
  for (size_t fareNum = 0; fareNum < m - 1; ++fareNum) {
    cin >> t >> r;
    data[fareNum] = make_pair(t, r);
    if (t > 0) lastEnters[t - 1] = fareNum;
  }
  for (size_t fareNum = 0; fareNum < m - 1; ++fareNum) {
    t = data[fareNum].first;
    r = data[fareNum].second;
    if (t > 0) a[t - 1]--;
    if (r == 1 && minRest != 0) {
      for (size_t dishNum = 0; dishNum < k; ++dishNum)
        if (a[dishNum] < minRest && lastEnters[dishNum] < fareNum)
          minRest = a[dishNum];
      for (size_t dishNum = 0; dishNum < k; ++dishNum)
        if (a[dishNum] > capacity || lastEnters[dishNum] >= fareNum)
          a[dishNum] += minRest;
      minRest = 0;
    }
    if (t == 0) capacity++;
  }
  for (size_t dishNum = 0; dishNum < k; ++dishNum)
    cout << ((a[dishNum] <= capacity) ? 'Y' : 'N');
  cout << "\n";
}
