#include<stdio.h>
#include<string.h>
int main(void){
int T,a,b,i,j,sum1,sum2;
char s1[200],s2[200];
scanf("%d",&T);
getchar();
while(T--){
sum1=sum2=0;
gets(s1);
gets(s2);
for(i=0;i<strlen(s1);i++){
if(s1[i]==' ')
continue;
sum1= sum1+1;
for(j=0;j<strlen(s2);j++){
if(s1[i]==s2[j]){
s2[j]='0';
}
}
}
for(j=0;j<strlen(s2);j++){
if(s2[j]=='0')
sum2 = sum2+1;
}
if(sum1==sum2)
printf("Yes\n");
else
printf("No\n");
}
printf("\n");
return 0;
}