#include <bits/stdc++.h>
using namespace std;
const int MOD = 1000000007;
template <class T>
typename T::value_type arr_sum(const T& v, int n) {
  typename T::value_type sum = 0;
  for (int i = (0); i < (n); ++i) sum += v[i];
  return sum;
}
struct Sync_stdio {
  Sync_stdio() {
    cin.tie(NULL);
    ios_base::sync_with_stdio(false);
  }
} _sync_stdio;
int main() {
  int t;
  cin >> t;
  for (int l = (0); l < (t); ++l) {
    int m, k;
    cin >> m >> k;
    vector<int> a(k);
    for (int i = 0; i < (k); ++i) cin >> a[i];
    ;
    vector<int> c = a;
    vector<pair<int, int> > b(m - 1);
    vector<int> used(k);
    int sum = 0;
    int sum_before = -1;
    for (int i = (0); i < (m - 1); ++i) {
      cin >> b[i].first >> b[i].second;
      --b[i].first;
      if (b[i].second == 1 && sum_before == -1) {
        sum_before = sum;
      }
      if (b[i].first != -1) {
        --a[b[i].first];
      } else {
        ++sum;
      }
    }
    int flag = 0;
    for (int i = (0); i < (m - 1); ++i) {
      if (b[i].second == 1) {
        flag = 1;
      }
      if (!flag) {
        continue;
      }
      if (b[i].first != -1) {
        used[b[i].first] = 1;
      }
    }
    string ans(k, 'N');
    int mini = -1;
    for (int i = (0); i < (k); ++i) {
      if (used[i]) {
        continue;
      }
      if (mini == -1 || a[i] < a[mini]) {
        mini = i;
      }
      if (a[i] <= sum_before) {
        ans[i] = 'Y';
      }
    }
    if (sum_before != -1) {
      sum -= a[mini];
    }
    for (int i = (0); i < (k); ++i) {
      if (a[i] - sum <= 0) {
        ans[i] = 'Y';
      }
    }
    cout << ans << "\n";
  }
}
