#include <bits/stdc++.h>
using namespace std;
struct Solver {
  void readInput() {
    cin >> m >> k;
    a.resize(k);
    for (int i = 0; i < k; ++i) {
      cin >> a[i];
    }
    t.resize(m - 1);
    r.resize(m - 1);
    for (int i = 0; i < m - 1; ++i) {
      cin >> t[i] >> r[i];
    }
  }
  string solve() {
    string answer;
    int firstUnhappy = -1;
    int unsure = 0;
    int unsureOnFirstUnhappy = -1;
    set<int> canBeFirstZero;
    for (int i = 0; i < m - 1; ++i) {
      if (r[i] == 1) {
        firstUnhappy = i;
        unsureOnFirstUnhappy = unsure;
        for (int i = 0; i < k; ++i) {
          if (a[i] <= unsure) {
            canBeFirstZero.insert(i);
          }
        }
        break;
      } else {
        if (t[i] != 0) {
          --a[t[i] - 1];
        } else {
          ++unsure;
        }
      }
    }
    if (firstUnhappy == -1) {
      for (int i = 0; i < k; ++i) {
        if (a[i] <= unsure) {
          answer += 'Y';
        } else {
          answer += 'N';
        }
      }
      return answer;
    } else {
      for (int i = firstUnhappy; i < m - 1; ++i) {
        if (t[i] != 0) {
          int dish = t[i] - 1;
          canBeFirstZero.erase(dish);
          --a[dish];
        } else {
          ++unsure;
        }
      }
    }
    assert(!canBeFirstZero.empty());
    int minA = 1e9;
    int minDish = -1;
    for (int dish : canBeFirstZero) {
      if (a[dish] < minA) {
        minA = a[dish];
        minDish = dish;
      }
    }
    assert(unsure >= minA);
    unsure -= minA;
    a[minDish] -= minA;
    for (int i = 0; i < k; ++i) {
      if ((a[i] <= unsure) ||
          (canBeFirstZero.find(i) != canBeFirstZero.end())) {
        answer += 'Y';
      } else {
        answer += 'N';
      }
    }
    return answer;
  }
  int m, k;
  vector<int> a;
  vector<int> t;
  vector<int> r;
};
int main() {
  ios::sync_with_stdio(false);
  int T;
  cin >> T;
  for (int t = 0; t < T; ++t) {
    Solver solver;
    solver.readInput();
    auto answer = solver.solve();
    cout << answer << endl;
  }
  return 0;
}
