#include <bits/stdc++.h>
#pragma comment(linker, "/STACK:60000000")
using namespace std;
const long double eps = 1e-9;
const int inf = (1 << 30) - 1;
const long long inf64 = ((long long)1 << 62) - 1;
const long double pi = 3.1415926535897932384626433832795;
const string task = "";
template <class T>
T sqr(T x) {
  return x * x;
}
int n, m;
int a[100500];
int last[100500];
char ans[100500];
int x[100500], y[100500];
void solve() {
  scanf("%d%d", &n, &m);
  for (int i = 0; i < (int)(m); i++) {
    scanf("%d", &a[i]);
    ans[i] = 'N';
    last[i] = -1;
  }
  for (int i = 0; i < (int)(n - 1); i++) {
    scanf("%d%d", &x[i], &y[i]);
    x[i]--;
    if (x[i] >= 0) last[x[i]] = i;
  }
  int s = 0;
  bool first = 1;
  for (int i = 0; i < (int)(n - 1); i++) {
    if (first && y[i] == 1) {
      first = 0;
      int mn = inf;
      for (int j = 0; j < (int)(m); j++)
        if (a[j] <= s && last[j] < i) {
          ans[j] = 'Y';
          mn = min(mn, a[j]);
        }
      s -= mn;
    }
    if (x[i] != -1) {
      a[x[i]]--;
    } else {
      s++;
    }
  }
  cerr << s << endl;
  for (int i = 0; i < (int)(m); i++)
    if (a[i] <= s) ans[i] = 'Y';
  for (int i = 0; i < (int)(m); i++) {
    printf("%c", ans[i]);
  }
  printf("\n");
}
int main() {
  int tt;
  scanf("%d", &tt);
  for (int ii = 0; ii < (int)(tt); ii++) solve();
  return 0;
}
