#include <bits/stdc++.h>
using namespace std;
const int INF = 0x3f3f3f3f;
const int N = 2e5 + 100;
int a[N];
int t[N], r[N];
int ok[N];
int m, k, lf;
int vis[N];
int main() {
  int T;
  scanf("%d", &T);
  while (T--) {
    scanf("%d%d", &m, &k);
    lf = 0;
    for (int i = 1; i <= k; ++i) scanf("%d", &a[i]);
    int f = 0;
    for (int i = 1; i < m; ++i) {
      scanf("%d%d", &t[i], &r[i]);
      f += r[i];
    }
    if (!f) {
      int lf = 0;
      for (int i = 1; i < m; ++i) {
        if (t[i])
          a[t[i]]--;
        else
          lf++;
      }
      for (int i = 1; i <= k; ++i) {
        if (a[i] <= lf)
          putchar('Y');
        else
          putchar('N');
      }
    } else {
      for (int i = 1; i <= k; ++i) vis[i] = 0, ok[i] = 1;
      int lf = 0;
      for (int i = 1; i < m; ++i) {
        if (r[i] && f) {
          f = 0;
          for (int j = i; j < m; ++j) vis[t[j]] = 1;
          int Mn = INF;
          for (int j = 1; j <= k; ++j) {
            if (vis[j]) continue;
            if (a[j] > lf) continue;
            Mn = min(Mn, a[j]);
            ok[j] = 0;
          }
          lf -= Mn;
        }
        if (t[i])
          a[t[i]]--;
        else
          lf++;
      }
      for (int i = 1; i <= k; ++i) {
        if (a[i] <= lf || !ok[i])
          putchar('Y');
        else
          putchar('N');
      }
    }
    puts("");
  }
  return 0;
}
