#include <bits/stdc++.h>
#pragma comment(linker, "/STACK:1000000000")
using namespace std;
const bool db = false;
int iterations, n, k, m;
int a[100010], b[100010], c[100010];
int t[100010], x[100010];
int df[100010];
void calc(int &cnt, int &ind) {
  int val = 1000000007;
  for (int i = 1; i <= k; ++i) {
    if (val > df[i]) {
      val = df[i];
    }
  }
  for (int i = 1; i <= k; ++i) {
    if (df[i] <= cnt) {
      b[i] = 0;
    }
  }
  cnt -= val;
  ind = 1;
}
int main() {
  scanf("%d", &iterations);
  while (iterations-- > 0) {
    scanf("%d%d", &m, &k);
    for (int i = 1; i <= k; ++i) {
      scanf("%d", &a[i]);
      c[i] = b[i] = a[i];
      df[i] = 1000000007;
    }
    for (int i = 1; i < m; ++i) {
      scanf("%d%d", &t[i], &x[i]);
      if (t[i] > 0) {
        --b[t[i]];
      }
    }
    for (int i = 1; i <= k; ++i) {
      if (a[i] == b[i]) {
        df[i] = b[i];
      }
    }
    int c0 = 0, c1 = 0, ind = 0;
    for (int i = 1; i < m; ++i) {
      if (t[i] == 0) {
        if (x[i] == 0) {
          ++c0;
        } else {
          ++c1;
          if (ind == 0) {
            calc(c0, ind);
          }
        }
      } else {
        if (x[i] == 1) {
          if (ind == 0) {
            calc(c0, ind);
          }
        }
        if (--c[t[i]] == b[t[i]]) {
          df[t[i]] = b[t[i]];
        }
      }
    }
    for (int i = 1; i <= k; ++i) {
      if (b[i] <= c0 + c1) {
        putchar('Y');
      } else {
        putchar('N');
      }
    }
    puts("");
  }
  getchar();
  getchar();
  return 0;
}
