/** * @author SCaffrey (srius.caffrey@gmail.com) * @date 2015-12-05 18:59:55 * @copyright MIT */ #include // NOLINT #include // NOLINT #include // NOLINT #define x1 x11 #define y1 y11 #define f(x, y, z) for (int x = (y), __ = (z); x < __; ++x) #define g(x, y, z) for (int x = (y), __ = (z); x <= __; ++x) #define fd(x, y, z) for (int x = (y), __ = (z); x > __; --x) #define gd(x, y, z) for (int x = (y), __ = (z); x >= __; --x) #ifdef WIN32 #define LLD "%I64d" #define LLU "%I64u" #else #define LLD "%lld" #define LLU "%llu" #endif typedef long long LL;// NOLINT typedef long double real; const double INF = 1e100; const int oo = ~0u >> 2; const double pi = acos(-1.0); const double EPS = 1e-8; const int MAXN = 100033; int T; int n; char a[MAXN], b[MAXN]; bool ck() { f(i, 0, n) { if (a[i] == 'A') { if (b[i] != 'U') return 0; } else if (a[i] == 'T') { if (b[i] != 'A') return 0; } else if (a[i] == 'C') { if (b[i] != 'G') return 0; } else if (a[i] != 'G') { if (b[i] != 'C') return 0; } } return 1; } int main() { #ifdef LOCAL freopen("a.in", "r", stdin); freopen("a.out", "w", stdout); #endif scanf("%d", &T); while (T--) { scanf("%d%s%s", &n, a, b); if (ck()) { puts("YES"); } else { puts("NO"); } } #ifdef LOCAL fclose(stdin); fclose(stdout); #endif return 0; }