#include <bits/stdc++.h> using namespace std; int main(){ ios::sync_with_stdio(false); cin.tie(0); cout.tie(0); // freopen("J1.in","r",stdin); // freopen("J1.out","w",stdout); int t; cin>>t; while (t--){ string a,b,c; cin>>a>>b; int flag = 0; int len1 = a.length(); int len2 = b.length(); if ((len1)%(len2) != 0){ cout<<"No"<<endl; flag = 1; } else for (int i=0;i<len1;i+=len2){ for (int j=i;j<len2;j++){ c+=a[j]; } if (c == b) continue; else { cout<<"No"<<endl; flag = 1; break; } } if (!flag){ cout<<"Yes"<<endl; } } return 0; }