#include <bits/stdc++.h>
using namespace std;
typedef int Arr[100005];
int n, m, QAQ, T;
Arr A, AA, CAN, SUM, Ans;
int main() {
  for (cin >> T; T--;) {
    cin >> n >> m;
    --n;
    for (int i = 1; i <= m; ++i) cin >> A[i], AA[i] = A[i], CAN[i] = Ans[i] = 0;
    QAQ = 0;
    for (int i = 1; i <= n; ++i) {
      int x, y;
      cin >> x >> y;
      --A[x];
      if (y == 1 && !QAQ) QAQ = i;
      if (QAQ)
        CAN[x] = 1;
      else
        --AA[x];
      SUM[i] = SUM[i - 1] + (!x);
    }
    if (QAQ) {
      int ma = 0;
      for (int i = 1; i <= m; ++i)
        if (!CAN[i] && AA[i] <= SUM[QAQ - 1])
          Ans[i] = 1, ma = max(ma, SUM[n] - AA[i]);
      for (int i = 1; i <= m; ++i)
        if (A[i] <= ma) Ans[i] = 1;
    } else
      for (int i = 1; i <= m; ++i) Ans[i] = A[i] <= SUM[n];
    for (int i = 1; i <= m; ++i) putchar(Ans[i] ? 'Y' : 'N');
    puts("");
  }
}
