#include int t, n; char dna[105], rna[105]; bool judge() { for (int i = 0; i < n; ++i) { if (dna[i] == 'A') { if (rna[i] != 'U') return false; } else if (dna[i] == 'C') { if (rna[i] != 'G') return false; } else if (dna[i] == 'G') { if (rna[i] != 'C') return false; } else { if (rna[i] != 'A') return false; } } return true; } int main() { scanf("%d", &t); while (t--) { scanf("%d", &n); scanf("%s %s", dna, rna); if (judge()) puts("YES"); else puts("NO"); } return 0; }