#include<string.h>
#include<iostream>
#include<string>
using namespace std;
string s1,s2,s3;
int vist[201][201];
int dfs(int a,int b,int c)
{
if(s3[c]=='\0') return 1; //s3搜完前提是条件都满足
if(vist[a][b]) return 0; //前面已经搜过了
vist[a][b]=1;
if(s1[a]==s3[c] && dfs(a+1,b,c+1)) return 1;
if(s2[b]==s3[c] && dfs(a,b+1,c+1)) return 1;
return 0;
}
int main()
{
int t,s=1;
cin>>t;
while(t--)
{
s1.clear();
s2.clear();
s3.clear();
cin>>s1>>s2>>s3;
memset(vist,0,sizeof(vist));
cout<<"Data set "<<s<<": ";
s++;
if(dfs(0,0,0))
{
cout<<"yes"<<endl;
}
else
{
cout<<"no"<<endl;
}
}
return 0;
}