#include <bits/stdc++.h>
using namespace std;
const int DIV = 1000000007;
int main(int argc, char* argv[]) {
  FILE* f = stdin;
  int test_count;
  fscanf(f, "%d\n", &test_count);
  for (int test = 0; test < test_count; test++) {
    int m, k;
    fscanf(f, "%d %d\n", &m, &k);
    vector<int> a(k + 1, 0);
    vector<bool> a_ended(k + 1, false);
    for (int i = 0; i < k; i++) fscanf(f, "%d", &a[i + 1]);
    bool first_step = true;
    for (int i = 1; i < m; i++) {
      int t, r;
      fscanf(f, "%d %d\n", &t, &r);
      if (first_step && r) {
        first_step = false;
        for (int j = 1; j <= k; j++) {
          if (a[j] <= a[0]) a_ended[j] = true;
        }
      }
      if (t == 0)
        a[0]++;
      else {
        a[t]--;
        if (a_ended[t]) a_ended[t] = false;
      }
    }
    if (!first_step) {
      int min = 100001;
      for (int j = 1; j <= k; j++) {
        if (a_ended[j] && a[j] < min) min = a[j];
      }
      a[0] -= min;
    }
    for (int j = 1; j <= k; j++) {
      if (a_ended[j] || a[j] <= a[0])
        printf("Y");
      else
        printf("N");
    }
    printf("\n");
  }
  return 0;
}
