#include #include #include using namespace std; const int maxn = 110 ; char s[maxn] ; char t[maxn] ; char s1[10] = "ATCG" ; char s2[10] = "UAGC" ; int main() { int T ; scanf("%d" , &T) ; while(T--){ int n ; scanf("%d" , &n); scanf("%s" , s) ; scanf("%s" , t) ; bool flag = false ; for(int i = 0;i < n;i++){ int pos ; for(int j = 0 ;j < 4;j++){ if(s[i] == s1[j]){ pos = j ; break ; } } if(t[i] != s2[pos]){ flag = true ; break ; } } if(!flag) puts("YES"); else puts("NO") ; } return 0 ; }