#include <bits/stdc++.h>

using namespace std;
using ll = long long;
using ld = long double;
using cll = const long long;
using ull = unsigned long long;

void Kus() { exit(0); }
ll rnd(cll RMOD) { return (rand() * rand()) % RMOD; };

#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>

template<typename a>
using pbds_tree = __gnu_pbds::tree<a, __gnu_pbds::null_type, less/**_equal*/<a>, 
__gnu_pbds::rb_tree_tag, __gnu_pbds::tree_order_statistics_node_update>;

template<typename a>
struct oset : public pbds_tree<a> {
    auto operator [] (ll index) {
        return *this -> find_by_order(index);
    }
};

#define INTERACTIVE false

/** fun begins */

cll MOD = 998244353;

// ll fen[1000000];

// ll fen_sum(ll idx) {
//     ll sum = 0;
//     for (ll i = idx; i > 0; i -= i & -i) {
//         sum += fen[i];
//     }
//     return sum;
// }

// void fen_upd(ll idx, ll x) {
//     for (ll i = idx; i <= n; i += i & -i) {
//         fen[i] += x;
//     }
// }

// ll fen_get(ll tl, ll tr) {
//     return fen_sum(tr) - fen_sum(tl - 1);
// }

ll bpow(ll x, ll y) {
    vector <ll> p(60, 1);
    p[1] = x;
    for (ll i = 2; i < 60; i++) {
        p[i] = (p[i - 1] * p[i - 1]) % MOD;
    }
    ll res = 1;
    for (ll i = 33; i >= 0; i--) {
        if (y >= (1 << i)) {
            res = (res * p[i + 1]) % MOD;
            y -= (1 << i);
        }
    }
    return res;
}

void rawr() {
    ll T;
    cin >> T;
    ll n, m;
    cin >> n >> m;
    vector <ll> x(n), y(n);
    for (ll i = 0; i < n; i++) {
        cin >> x[i] >> y[i];
    }
    string s;
    cin >> s;
    if (n == 1) {
        for (ll i = 1; i < s.size(); i++) {
            if (s[i] != s[i - 1]) {
                cout << "No";
                return;
            }
        }
        cout << "Yes";
        return;
    }
    for (ll i = 0; i < n; i++) {
        if (i != 0 && (x[i]) % 2 != (x[i - 1]) % 2) {
            cout << "No";
            return;
        }
    }
    cout << "Yes";
}

/** fun is over */

int32_t main() {
    srand(time(0));
    random_device rd;
    mt19937 gen(rd());
#if defined (LOCAL) && (INTERACTIVE == false)
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
#endif
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);
    /** Meow begins */
    ll _ = 1;
    // cin >> _;
    while (_--) {
        rawr();
    }
    /** Meow is over */
    Kus();
}
