#include <bits/stdc++.h>
using namespace std;
int main() {
  vector<int> a(100001);
  vector<int> b(100001);
  vector<bool> used(100001, false);
  int n, m, k, l, r, d, dc;
  cin >> n;
  for (int i = 1; i <= n; i++) {
    bool flag = false;
    cin >> m >> k;
    for (int j = 1; j <= k; j++) {
      cin >> a[j];
      used[j] = false;
    }
    d = 0;
    dc = 0;
    for (int j = 1; j <= m - 1; j++) {
      cin >> l >> r;
      if (r == 1 && !flag) {
        flag = true;
        for (int j = 1; j <= k; j++) {
          b[j] = a[j];
          dc = d;
        }
      }
      if (l != 0) {
        if (flag) {
          used[l] = true;
          b[l]--;
        } else {
          a[l]--;
        }
      } else {
        d++;
      }
    }
    int min = 1000000;
    for (int j = 1; j <= k; j++) {
      if (!used[j] && a[j] <= dc) {
        if (a[j] < min) min = a[j];
        b[j] = 0;
      }
    }
    if (flag && min != 1000000) d -= min;
    if (flag) {
      for (int j = 1; j <= k; j++) {
        if (b[j] - d > 0)
          cout << 'N';
        else
          cout << 'Y';
      }
    } else {
      for (int j = 1; j <= k; j++) {
        if (a[j] - d > 0)
          cout << 'N';
        else
          cout << 'Y';
      }
    }
    cout << endl;
  }
  return 0;
}
