#include <bits/stdc++.h>
using namespace std;
void solve() {
  int m, k;
  scanf("%d %d", &m, &k);
  vector<int> a(k, 0);
  vector<int> t(m - 1), r(m - 1, 0);
  vector<int> last(k, 0);
  for (int i = 0; i < k; ++i) {
    scanf("%d", &a[i]);
  }
  int free_num = 0;
  for (int i = 0; i + 1 < m; ++i) {
    scanf("%d %d", &t[i], &r[i]);
    if (t[i] > 0) {
      last[t[i] - 1] = i;
    }
  }
  int first_upset_id = -1;
  int before_upset_num = 0;
  for (int i = 0; i + 1 < m; ++i) {
    if (r[i] == 1) {
      first_upset_id = i;
      break;
    } else if (t[i] == 0) {
      ++before_upset_num;
    }
  }
  for (int i = 0; i + 1 < m; ++i) {
    if (t[i] == 0) {
      ++free_num;
    } else {
      --a[t[i] - 1];
    }
  }
  if (first_upset_id >= 0) {
    int min_id = -1;
    for (int i = 0; i < k; ++i) {
      if ((last[i] < first_upset_id) &&
          ((min_id == -1) || (a[min_id] > a[i]))) {
        min_id = i;
      }
    }
    free_num -= a[min_id];
  }
  for (int i = 0; i < k; ++i) {
    if ((a[i] <= free_num) ||
        ((last[i] < first_upset_id) && (a[i] <= before_upset_num))) {
      printf("Y");
    } else {
      printf("N");
    }
  }
  printf("\n");
}
int main() {
  int t;
  scanf("%d", &t);
  while (t--) {
    solve();
  }
  return 0;
}
