#include <bits/stdc++.h>
using namespace std;
int t, m, k, a[100005], c[100005], r[100005];
bool vis[100005], ex[100005];
int main() {
  scanf("%d", &t);
  while (t--) {
    scanf("%d%d", &m, &k), m--;
    for (int i = 1; i <= k; ++i) scanf("%d", a + i);
    int cnt = 0;
    bool flag = 1;
    for (int i = 1; i <= m; ++i) scanf("%d%d", c + i, r + i);
    for (int i = 1; i <= k; ++i) vis[i] = 0, ex[i] = 0;
    for (int i = 1; i <= m; ++i) {
      if (r[i] && flag) {
        flag = 0;
        for (int j = i; j <= m; ++j) vis[c[j]] = 1;
        int mn = 0x7f7f7f7f;
        for (int j = 1; j <= k; ++j)
          if (cnt >= a[j] && !vis[j]) {
            ex[j] = 1;
            if (mn > a[j]) mn = a[j];
          }
        if (mn == 0x7f7f7f7f) {
          puts("Error");
          return 0;
        }
        cnt -= mn;
      }
      if (c[i])
        a[c[i]]--;
      else
        cnt++;
    }
    for (int i = 1; i <= k; ++i)
      if (!ex[i] && cnt >= a[i]) ex[i] = 1;
    for (int i = 1; i <= k; ++i)
      if (ex[i])
        putchar('Y');
      else
        putchar('N');
    puts("");
  }
}
