#include #include #include #include using namespace std; char A[200],B[200]; int n; inline bool check() { int i; for (i=1;i<=n;i++) { if (A[i]=='A' && (B[i]!='U')) return false; if (A[i]=='T' && (B[i]!='A')) return false; if (A[i]=='C' && (B[i]!='G')) return false; if (A[i]=='G' && (B[i]!='C')) return false; } return true; } int main() { int T; scanf("%d",&T); for (int kase=1;kase<=T;kase++) { scanf("%d",&n); scanf("%s",A+1); scanf("%s",B+1); if (check()) printf("YES\n"); else printf("NO\n"); } return 0; }