#include <bits/stdc++.h>
using namespace std;
#define ll long long
const ll MOD = 1e9 + 7;
const double PI = 3.14159265358979323846;

signed main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);

    ll t = 1, n, m, k, a, b, c, d, e, f, w, h, x1, x2, y2, l, r, y, z, q;
    string s, x;
    //char x, y;
    cin >> t;
    while (t--) {
        cin >> n >> s >> x;
        if (x.find('o') != string::npos) cout << "YES\n";
        else cout << "NO\n";
    }

    return 0;
}