#include <bits/stdc++.h>
using namespace std;
int T;
int m, n;
int cnt[100005];
int pre[100005];
int sum, sum_pre;
int res[100005];
int dish[100005], stop;
int dish1, orz;
int main() {
  scanf("%d", &T);
  while (T--) {
    sum = 0;
    sum_pre = 0;
    memset(dish, 1, sizeof(dish));
    memset(res, 0, sizeof(res));
    scanf("%d%d", &m, &n);
    for (int i = 1; i <= n; ++i) {
      scanf("%d", &cnt[i]);
      pre[i] = cnt[i];
    }
    stop = 0;
    for (int i = 1; i <= m - 1; ++i) {
      scanf("%d%d", &dish1, &orz);
      if (dish1)
        cnt[dish1]--;
      else
        sum++;
      if (stop) {
        dish[dish1] = 0;
        continue;
      }
      if (orz) {
        dish[dish1] = 0;
        stop = 1;
        continue;
      }
      if (dish1)
        pre[dish1]--;
      else
        sum_pre++;
    }
    if (stop) {
      int rem = 0;
      for (int i = 1; i <= n; ++i) {
        if (dish[i] && pre[i] <= sum_pre) {
          res[i] = 1;
          rem = max(rem, sum - pre[i]);
        }
      }
      for (int i = 1; i <= n; ++i) {
        if (cnt[i] <= rem) {
          res[i] = 1;
        }
      }
    } else {
      for (int i = 1; i <= n; ++i) {
        res[i] = cnt[i] <= sum;
      }
    }
    for (int i = 1; i <= n; ++i) {
      if (res[i])
        printf("Y");
      else
        printf("N");
    }
    printf("\n");
  }
}
