#include <bits/stdc++.h>
using namespace std;
#pragma comment(linker, "/STACK:100000000")
int a[100500], b[100500], c[100500];
int t[100500], r[100500];
char ans[100500];
void solve() {
  int m, k;
  scanf("%d%d", &m, &k);
  for (int i = 0; i < k; ++i) {
    scanf("%d", &a[i]);
    b[i] = a[i];
    c[i] = a[i];
  }
  int total_zeroes = 0;
  for (int i = 0; i < m - 1; ++i) {
    scanf("%d%d", &t[i], &r[i]);
    t[i]--;
    if (t[i] == -1) {
      total_zeroes++;
    } else {
      b[t[i]]--;
    }
  }
  int was_fail = false;
  int cur_zeroes = 0;
  for (int i = 0; i < k; ++i) {
    ans[i] = 'N';
  }
  for (int i = 0; i < m - 1; ++i) {
    if (r[i] == 1 && !was_fail) {
      was_fail = true;
      int min_j = -1;
      for (int j = 0; j < k; ++j) {
        if (b[j] == c[j] && c[j] <= cur_zeroes) {
          ans[j] = 'Y';
          if (min_j == -1 || c[j] < c[min_j]) {
            min_j = j;
          }
        }
      }
      total_zeroes -= c[min_j];
      break;
    }
    if (t[i] == -1) {
      cur_zeroes++;
    } else {
      c[t[i]]--;
    }
  }
  for (int i = 0; i < k; ++i) {
    if (ans[i] == 'N' && b[i] <= total_zeroes) {
      ans[i] = 'Y';
    }
  }
  for (int i = 0; i < k; ++i) {
    printf("%c", ans[i]);
  }
  printf("\n");
}
int main() {
  int t;
  scanf("%d", &t);
  for (int i = 0; i < t; ++i) {
    solve();
  }
  return 0;
}
