#include #include #include #include #include #include #include using namespace std; const int N=105; int T,n; char s1[N],s2[N]; bool check() { for (int i=1;i<=n;i++) { if (s1[i]=='A'&&s2[i]!='U') return 0; if (s1[i]=='T'&&s2[i]!='A') return 0; if (s1[i]=='C'&&s2[i]!='G') return 0; if (s1[i]=='G'&&s2[i]!='C') return 0; } return 1; } int main() { cin>>T; while (T--) { scanf("%d\n%s\n%s",&n,s1+1,s2+1); if (check()) printf("YES\n"); else printf("NO\n"); } }