#include <bits/stdc++.h>
using namespace std;
const long long INF = 1e9;
const long double EPS = 1e-10;
void solve() {
  int m, k;
  scanf("%d%d", &m, &k);
  vector<int> a(k);
  for (int i = 0; i < a.size(); i++) {
    cin >> a[i];
  }
  vector<pair<int, int> > hist;
  vector<int> lastUsed(k, -1);
  int M = m - 1;
  for (int i = 0; i < M; i++) {
    int t, r;
    scanf("%d%d", &t, &r);
    hist.push_back(make_pair(t, r));
    if (t) {
      lastUsed[t - 1] = max(lastUsed[t - 1], i);
    }
  }
  bool flag = false;
  int cnt = 0;
  for (int i = 0; i < hist.size(); i++) {
    int t, r;
    t = hist[i].first;
    r = hist[i].second;
    if (!flag && r) {
      flag = true;
      int minel = INF;
      for (int j = 0; j < a.size(); j++) {
        if (lastUsed[j] < i) minel = min(minel, a[j]);
      }
      for (int j = 0; j < a.size(); j++) {
        if (lastUsed[j] < i && a[j] <= cnt) a[j] = 0;
      }
      cnt -= minel;
    }
    if (t == 0)
      cnt++;
    else {
      a[t - 1]--;
    }
  }
  for (int i = 0; i < a.size(); i++) {
    a[i] -= cnt;
    if (a[i] <= 0)
      printf("Y");
    else
      printf("N");
  }
  printf("\n");
}
int main() {
  int t;
  scanf("%d", &t);
  for (int i = 0; i < t; i++) {
    solve();
  }
  return 0;
}
