#include #define All(x) x.begin(),x.end() #define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0); using namespace std; using ll=long long; bool in_trapped_set(const string &s){ int n=s.size(); int last_g=-1; int first_d=n; for(int i=0;i=3; } void solve(){ string s,t; cin>>s>>t; string ss=s,st=t; sort(All(ss)); sort(All(st)); if(ss!=st){ cout<<"No\n"; return ; } cout<<(in_trapped_set(s)==in_trapped_set(t)?"Yes":"No")<<'\n'; } signed main(){ IOS int T; cin>>T; while(T--){ solve(); } }