#include <bits/stdc++.h>
using namespace std;
bool debug = 1;
int n, m, k;
int dx[4] = {0, 1, 0, -1}, dy[4] = {1, 0, -1, 0};
long long ln, lk, lm;
int a[100105], t[100105], r[100105], rm[100105], ans[100105], cnt;
void cal() {
  cnt++;
  scanf("%d%d", &m, &k);
  for (int(i) = 1; (i) <= (int)(k); (i)++) scanf("%d", a + i);
  unordered_map<int, int> mp;
  for (int(i) = 1; (i) <= (int)(m - 1); (i)++) {
    scanf("%d%d", t + i, r + i);
    if (t[i] != 0) {
      mp[t[i]]++;
      a[t[i]]--;
    }
  }
  priority_queue<pair<int, int>, std::vector<pair<int, int>>,
                 std::greater<pair<int, int>>>
      q;
  for (int(i) = 1; (i) <= (int)(k); (i)++)
    if (mp.find(i) == mp.end()) {
      q.push({a[i], i});
    }
  int x = 0, mi = -1;
  for (int(i) = 1; (i) <= (int)(m); (i)++) {
    if ((i == m || (i < m && r[i] == 1)) && !q.empty()) {
      if (mi == -1) {
        auto p = q.top();
        q.pop();
        mi = p.first;
        if (mi <= x)
          ans[p.second] = cnt;
        else
          assert(m == i);
        while (!q.empty() && x >= q.top().first) {
          auto p = q.top();
          q.pop();
          ans[p.second] = cnt;
        }
      } else
        while (!q.empty() && x - mi >= q.top().first) {
          auto p = q.top();
          q.pop();
          ans[p.second] = cnt;
        }
    }
    if (i < m) {
      if (t[i] != 0) {
        mp[t[i]]--;
        if (mp[t[i]] == 0) q.push({a[t[i]], t[i]});
      } else
        x++;
    }
  }
  for (int(i) = 1; (i) <= (int)(k); (i)++) {
    printf("%c", ans[i] == cnt ? 'Y' : 'N');
  }
  puts("");
}
int main() {
  int t;
  scanf("%d", &t);
  while (t--) {
    cal();
  }
  return 0;
}
