/* *********************************************** Author :kuangbin Created Time :2015/12/5 18:55:26 File Name :F:\ACM\2015ACM\BestCoder\BC65\A.cpp ************************************************ */ #include #include #include #include #include #include #include #include #include #include #include #include using namespace std; char str1[110],str2[110]; int main() { //freopen("in.txt","r",stdin); //freopen("out.txt","w",stdout); int T; int n; scanf("%d",&T); while(T--) { scanf("%d",&n); scanf("%s%s",str1,str2); bool flag = true; for(int i = 0;i < n;i++) { if(str1[i] == 'A' && str2[i] == 'U')continue; if(str1[i] == 'T' && str2[i] == 'A')continue; if(str1[i] == 'C' && str2[i] == 'G')continue; if(str1[i] == 'G' && str2[i] == 'C')continue; flag = false; } if(flag)puts("YES"); else puts("NO"); } return 0; }