#include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #define F1(x,y,z) for(int x=y;xz;x--) #define F4(x,y,z) for(int x=y;x>=z;x--) #define pb push_back #define LL long long #define co complex #define MAX 100005 #define AMAX 1500 #define MOD 1000000007 #define f(c,d) ((1<<(c))*(d)) using namespace std; int t,n; char x[105],y[105]; int cnt; int main(){ scanf("%d",&t); while(t--){ scanf("%d%s%s",&n,x,y); cnt=0; F1(a,0,n){ if(x[a]=='A'&&y[a]=='U')cnt++; if(x[a]=='T'&&y[a]=='A')cnt++; if(x[a]=='C'&&y[a]=='G')cnt++; if(x[a]=='G'&&y[a]=='C')cnt++; } printf(cnt==n?"YES\n":"NO\n"); } //system("pause"); return 0; }