http://acm.hdu.edu.cn/showproblem.php?pid=1501
#include <iostream>
#include <cstring>
#include <algorithm>
#include <cstdio>
#include <queue>
#include <map>
#include <set>
#include <stack>
using namespace std;
#define sfi(x) scanf("%d",&x)
#define sfc(x) scanf("%c",x)
#define sfl(x) scanf("%lld",&x)
#define sfs(x) scanf("%s",x)
#define rint register int
#define pb push_back
#define fl() printf("flag!\n")
#define INF 0x3f3f3f3f
#define ll long long
#define mem(x,y) memset(x,y,sizeof(x))
#define FAST_IO ios::sync_with_stdio(false);cin.tie(0);cout.tie(0)
const int maxn=1e6+9;
bool dp[209][209];
string s1,s2,s3;
int ans;
int len1,len2;
void dfs(int pos1,int pos2,int pos3)
{
if(ans) return ;
if(len1==pos1&&len2==pos2)
{
ans=1;
return ;
}
if(dp[pos1][pos2])
{
return ;
}
dp[pos1][pos2]=1;
if(s1[pos1]==s3[pos3]) dfs(pos1+1,pos2,pos3+1);
if(s2[pos2]==s3[pos3]) dfs(pos1,pos2+1,pos3+1);
}
int main()
{
//FAST_IO;
//freopen("input.txt","r",stdin);
int T;
sfi(T);
int cas=1;
while(T--)
{
mem(dp,0);
ans=0;
cin>>s1>>s2>>s3;
len1=s1.length();
len2=s2.length();
dfs(0,0,0);
printf("Data set %d: %s\n",cas++,ans==1?"yes":"no");
}
}