#include <bits/stdc++.h>
using namespace std;
long long gcd(long long a, long long b) { return b == 0 ? a : gcd(b, a % b); }
int npers, ndish;
int have[100000];
int got[99999], mumble[99999];
bool canfirstempty[100000];
void run() {
  scanf("%d%d", &npers, &ndish);
  for (int i = (0); i < (ndish); ++i) scanf("%d", &have[i]);
  for (int i = (0); i < (npers - 1); ++i) {
    scanf("%d%d", &got[i], &mumble[i]);
    --got[i];
  }
  for (int i = (0); i < (ndish); ++i) canfirstempty[i] = true;
  bool mumbled = false;
  int nfreebeforemumble = 0, nfreeaftermumble = 0;
  for (int i = (0); i < (npers - 1); ++i) {
    if (mumble[i] == 1) mumbled = true;
    if (got[i] == -1) {
      if (!mumbled)
        nfreebeforemumble++;
      else
        nfreeaftermumble++;
      continue;
    }
    assert(have[got[i]] >= 1);
    have[got[i]]--;
    if (mumbled) canfirstempty[got[i]] = false;
  }
  int minneededbeforemumble = nfreebeforemumble;
  for (int i = (0); i < (ndish); ++i)
    if (canfirstempty[i] && have[i] < minneededbeforemumble)
      minneededbeforemumble = have[i];
  for (int i = (0); i < (ndish); ++i) {
    int maxfree = 0;
    if (canfirstempty[i] && have[i] <= nfreebeforemumble)
      maxfree = nfreebeforemumble + nfreeaftermumble;
    else
      maxfree = nfreebeforemumble - minneededbeforemumble + nfreeaftermumble;
    printf("%c", maxfree >= have[i] ? 'Y' : 'N');
  }
  puts("");
}
int main() {
  int n;
  scanf("%d", &n);
  for (int i = (1); i <= (n); ++i) run();
  return 0;
}
