#include <bits/stdc++.h>
int main() {
  std::ios::sync_with_stdio(false);
  int t;
  std::cin >> t;
  for (int tt = 0; tt < t; tt++) {
    int m, k;
    std::cin >> m;
    std::cin >> k;
    std::vector<int> a(k);
    std::vector<int> fucked(k);
    std::vector<int> fuckedBeforeBorm(k);
    std::vector<int> last(k);
    for (int i = 0; i < k; i++) {
      std::cin >> a[i];
      fucked[i] = 0;
      last[i] = 0;
    }
    std::vector<int> choice(m);
    int borm = -1;
    int huiBeforeBorm = 0;
    int hui = 0;
    int looser = -1;
    for (int i = 0; i < m - 1; i++) {
      std::cin >> choice[i];
      choice[i]--;
      int x;
      std::cin >> x;
      if (x == 1 && borm == -1) {
        borm = i;
      }
      if (choice[i] == -1) {
        hui++;
        if (borm == -1) huiBeforeBorm++;
      } else {
        last[choice[i]] = i;
        fucked[choice[i]]++;
        if (borm == -1) fuckedBeforeBorm[choice[i]]++;
      }
    }
    for (int j = 0; j < k; j++) {
      if (last[j] < borm && a[j] - huiBeforeBorm - fuckedBeforeBorm[j] <= 0) {
        if (looser == -1) {
          looser = j;
        } else {
          if (a[j] - fuckedBeforeBorm[j] < a[looser] - fuckedBeforeBorm[looser])
            looser = j;
        }
      }
    }
    for (int i = 0; i < k; i++) {
      if (borm == -1) {
        if (fucked[i] + hui >= a[i])
          std::cout << "Y";
        else
          std::cout << "N";
      } else {
        if (last[i] < borm && a[i] - fuckedBeforeBorm[i] - huiBeforeBorm <= 0)
          std::cout << "Y";
        else {
          if (looser != -1 &&
              fucked[i] + hui - (a[looser] - fuckedBeforeBorm[looser]) >=
                  a[i]) {
            std::cout << "Y";
          } else {
            std::cout << "N";
          }
        }
      }
    }
    std::cout << std::endl;
  }
  return 0;
}
