#include <bits/stdc++.h>
using namespace std;
int n, m, k, a[200000], b[200000], w[200000], t[200000], ans[200000];
int main() {
  cin >> n;
  while (n--) {
    cin >> m >> k;
    for (int i = 1; i <= k; i++) {
      cin >> a[i];
      b[i] = a[i];
      ans[i] = 0;
    }
    int totalZero = 0, s = 0;
    for (int i = 1; i < m; i++) {
      cin >> w[i] >> t[i];
      s += t[i];
      if (w[i] > 0)
        b[w[i]]--;
      else
        totalZero++;
    }
    if (s == 0) {
      for (int i = 1; i <= k; i++)
        if (b[i] <= totalZero) ans[i] = 1;
    } else {
      int curZero = 0;
      for (int i = 1; i < m; i++) {
        if (t[i] == 1) {
          int minU = 2e9;
          for (int j = 1; j <= k; j++)
            if (a[j] <= curZero && b[j] == a[j]) {
              ans[j] = 1;
              minU = min(minU, a[j]);
            }
          for (int j = 1; j <= k; j++)
            if (ans[j] == 0 && totalZero - minU >= b[j]) ans[j] = 1;
          break;
        };
        if (w[i] > 0)
          a[w[i]]--;
        else
          curZero++;
      }
    }
    for (int i = 1; i <= k; i++)
      if (ans[i])
        cout << 'Y';
      else
        cout << 'N';
    cout << endl;
  }
  return 0;
};
