#include <bits/stdc++.h>
using namespace std;
const int N = 1e5 + 100;
int v[N];
bool ans[N];
bool visit[N];
int main() {
  int casnum, n, m;
  cin >> casnum;
  while (casnum--) {
    memset(visit, 0, sizeof(visit));
    memset(ans, 0, sizeof(ans));
    scanf("%d%d", &n, &m);
    for (int i = (1); i <= (m); ++i) scanf("%d", &v[i]);
    vector<pair<int, int> > vec;
    for (int i = 0; i < (n - 1); ++i) {
      int x, y;
      scanf("%d%d", &x, &y);
      vec.push_back(pair<int, int>(x, y));
    }
    bool flag = 0;
    int tmp = 0;
    for (int i = 0; i < (vec.size()); ++i) {
      if (!flag && vec[i].second == 1) {
        flag = 1;
        for (int j = (i); j <= (vec.size() - 1); ++j) visit[vec[j].first] = 1;
        int value = 1e9;
        for (int j = (1); j <= (m); ++j)
          if (!visit[j]) value = min(value, v[j]);
        for (int j = (1); j <= (m); ++j)
          if (!visit[j] && v[j] <= tmp) v[j] = 0;
        tmp -= value;
      }
      if (vec[i].first)
        --v[vec[i].first];
      else
        ++tmp;
    }
    for (int i = (1); i <= (m); ++i) {
      if (tmp >= v[i] || ans[i])
        putchar('Y');
      else
        putchar('N');
    }
    puts("");
  }
  return 0;
}
