#include <bits/stdc++.h>
using namespace std;
int kk[(100010)];
map<int, int> possible;
int main() {
  int t, m, k, tj, rj, pre(0);
  bool first(false), already(false);
  scanf("%d", &t);
  for (int i = 0; i < t; ++i) {
    first = false;
    already = false;
    pre = 0;
    possible.clear();
    scanf("%d%d", &m, &k);
    for (int j = 1; j <= k; ++j) {
      scanf("%d", &kk[j]);
    }
    for (int j = 0; j < m - 1; ++j) {
      scanf("%d%d", &tj, &rj);
      if (rj == 1 && !first) {
        first = true;
        for (int l = 1; l <= k; ++l) {
          if (kk[l] == 0) {
            already = true;
            break;
          }
        }
        if (!already) {
          for (int l = 1; l <= k; ++l) {
            if (kk[l] <= pre) {
              possible[l] = kk[l];
            }
          }
        }
      }
      if (tj == 0) {
        pre += 1;
      } else {
        kk[tj] -= 1;
        if (first && !already) {
          if (possible[tj] != 0) {
            possible.erase(tj);
          }
        }
      }
    }
    if (!already && first) {
      int min = 100001;
      map<int, int>::iterator it = possible.begin();
      while (it != possible.end()) {
        int count = (*it).second;
        if (count != 0 && count < min) {
          min = (*it).second;
        }
        it++;
      }
      pre -= min;
    }
    for (int j = 1; j <= k; ++j) {
      if (possible[j] != 0) {
        printf("%c", 'Y');
      } else if (kk[j] <= pre) {
        printf("%c", 'Y');
      } else {
        printf("%c", 'N');
      }
    }
    printf("\n");
  }
}
