#include using namespace std; using ll = long long; int main() { ios::sync_with_stdio(false); cin.tie(nullptr); int T; cin >> T; while (T--) { int N; cin >> N; map mx, my; int xc = 0, yc = 0; for (int i = 0; i < 2 * N; i++) { int X, Y; char c; cin >> X >> Y >> c; if (c == 'x') { xc++; mx[Y]++; } else { yc++; my[X]++; } } if (xc == yc) { cout << "Yes\n"; } else if (xc > yc) { int s = 0; for (auto [_, c]: mx) s += c / 2; cout << (s >= (xc - yc) / 2 ? "Yes\n" : "No\n"); } else { int s = 0; for (auto [_, c]: my) s += c / 2; cout << (s >= (yc - xc) / 2 ? "Yes\n" : "No\n"); } } }