/********************************************* Problem : HDU 5170 Author : NMfloat InkTime (c) NM . All Rights Reserved . ********************************************/ #include #include #include #include #include #include #include #include #include #include #define rep(i,a,b) for(int i = a ; i <= b ; i ++) #define rrep(i,a,b) for(int i = b ; i >= a ; i --) #define repE(p,u) for(Edge * p = G[u].first ; p ; p = p -> next) #define cls(a,x) memset(a,x,sizeof(a)) #define eps 1e-8 using namespace std; const int MOD = 1e9+7; const int INF = 0x3f3f3f3f; const int MAXN = 1e5; const int MAXE = 2e5; typedef long long LL; int T,n,m,k; char s1[105],s2[105]; void input() { scanf("%d",&n); scanf("%s%s",s1,s2); } void solve() { int lens = strlen(s1); int ok = 0; rep(i,0,lens-1) { if(s1[i] == 'A') if(s2[i] != 'U') ok = 1; if(s1[i] == 'T') if(s2[i] != 'A') ok = 1; if(s1[i] == 'C') if(s2[i] != 'G') ok = 1; if(s1[i] == 'G') if(s2[i] != 'C') ok = 1; } if(ok == 0) puts("YES"); else puts("NO"); } int main(void) { //freopen("a.in","r",stdin); scanf("%d",&T); while(T--) { //while(~scanf("%d %d %d %d",&a,&b,&c,&d)) { input(); solve(); } return 0; }