#include <bits/stdc++.h>
using namespace std;
int main() {
  int t;
  cin >> t;
  vector<vector<char>> result;
  for (int j = (0); j < (t); j++) {
    int n, m, k;
    bool afternoenjoy = 0;
    cin >> m >> k;
    vector<int> mit(k, 0), a(k);
    vector<char> res(k, 'N');
    int numberto = 0, numberafter = 0, minn = 1000 * 1000 * 1000, x, y;
    for (int i = (0); i < (k); i++) cin >> a[i];
    for (int i = (0); i < (m - 1); i++) {
      cin >> x >> y;
      x--;
      if (y == 1 && !afternoenjoy) afternoenjoy = 1;
      if (x >= 0) {
        a[x]--;
      } else if (!afternoenjoy)
        numberto++;
      else
        numberafter++;
      if (afternoenjoy && x >= 0) mit[x] = 1;
    }
    for (int i = (0); i < (a.size()); i++) {
      if (!mit[i] && numberto >= a[i]) {
        minn = min(minn, a[i]);
        res[i] = 'Y';
      }
    }
    numberafter += numberto - minn;
    for (int i = (0); i < (a.size()); i++) {
      if (a[i] <= numberafter) res[i] = 'Y';
    }
    result.push_back(res);
  }
  for (int i = (0); i < (result.size()); i++) {
    for (int j = (0); j < (result[i].size()); j++) cout << result[i][j];
    cout << endl;
  }
  return 0;
}
