#include <bits/stdc++.h>
using namespace std;
int tt, m, k;
int a[100005];
int t[100005], r[100005];
char ans[100005];
int zc, zzc;
bool f[100005];
int main() {
  scanf("%d", &tt);
  for (int test = 0; test < (int)(tt); ++test) {
    zc = zzc = 0;
    scanf("%d%d", &m, &k), --m;
    for (int i = 0; i < (int)(k); ++i) scanf("%d", a + i);
    for (int i = 0; i < (int)(m); ++i) scanf("%d%d", t + i, r + i), --t[i];
    int pos = -1;
    for (int i = 0; i < (int)(m); ++i)
      if (r[i] == 1) {
        pos = i;
        break;
      }
    for (int i = 0; i < (int)(k); ++i) f[i] = true;
    for (int i = 0; i < (int)(m); ++i) {
      if (t[i] != -1) {
        --a[t[i]];
        if (i >= pos) f[t[i]] = false;
      } else {
        ++zc;
        if (i < pos) ++zzc;
      }
    }
    if (pos == -1) {
      for (int i = 0; i < (int)(k); ++i) {
        if (zc >= a[i])
          ans[i] = 'Y';
        else
          ans[i] = 'N';
      }
    } else {
      int best = 2e9;
      for (int i = 0; i < (int)(k); ++i)
        if (f[i] && a[i] <= zzc) best = min(best, a[i]);
      for (int i = 0; i < (int)(k); ++i) {
        if (f[i] && a[i] <= zzc) {
          ans[i] = 'Y';
          continue;
        }
        if (a[i] <= zc - best) {
          ans[i] = 'Y';
        } else {
          ans[i] = 'N';
        }
      }
    }
    ans[k] = '\0';
    printf("%s\n", ans);
  }
  return 0;
}
