#include <bits/stdc++.h>
using namespace std;
int a[1000000];
bool was[1000000];
bool can[1000000];
int main() {
  int t;
  cin >> t;
  while (t--) {
    int m, k;
    cin >> m >> k;
    for (int i = 0; i < k; i++) cin >> a[i];
    for (int i = 0; i < k; i++) can[i] = false;
    vector<pair<int, int> > q;
    for (int i = 0; i < m - 1; i++) {
      int x, y;
      cin >> x >> y;
      x--;
      q.push_back(make_pair(x, y));
    }
    int u = -1;
    int v = 0;
    for (int i = 0; i < m - 1; i++) {
      if (q[i].second == 1 && u == -1) {
        for (int j = 0; j < k; j++) was[j] = false;
        for (int j = i; j < m - 1; j++)
          if (q[j].first >= 0) was[q[j].first] = true;
        for (int j = 0; j < k; j++)
          if (!was[j] && a[j] <= v) {
            can[j] = true;
            if (u == -1 || a[j] < a[u]) u = j;
          }
        v -= a[u];
        a[u] = 0;
      }
      if (q[i].first >= 0)
        a[q[i].first]--;
      else
        v++;
    }
    for (int i = 0; i < k; i++)
      if (a[i] <= v) can[i] = true;
    for (int i = 0; i < k; i++)
      if (can[i])
        cout << "Y";
      else
        cout << "N";
    cout << endl;
  }
  return 0;
}
