#include #include #include #include #include #include #include #include #define inf 0x333f3f3f #define mod 9999991 using namespace std; void fre(){freopen("d://input.txt","r",stdin);freopen("d://output.txt","w",stdout);} #define MS(x,y) memset(x,y,sizeof(x)) typedef __int64 LL; const int N=105; char s1[N],s2[N]; map mp; int main(){ int t,n; mp['A']='U';mp['T']='A';mp['G']='C';mp['C']='G'; scanf("%d",&t); //getchar(); while(t--){ scanf("%d",&n); scanf("%s",s1); scanf("%s",s2); int flag=1; for(int i=0;s1[i]!='\0';i++){ if(mp[s1[i]]==s2[i]) continue; else{ flag=0;break; } } if(flag) puts("YES"); else puts("NO"); } return 0; }