#include #include #include using namespace std; int main() { int T, n; string a, b; cin >> T; while(T--) { cin >> n; cin >> a >> b; for(int i = 0; i < n; ++i) { if (a[i]=='A') a[i] = 'U'; else if(a[i]=='C') a[i] = 'G'; else if(a[i]=='G') a[i] = 'C'; else if(a[i]=='T') a[i] = 'A'; } if (a==b) cout << "YES" << endl; else cout << "NO" << endl; } return 0; }