//s[i][j]:表示st1[i],st2[j]能否组合成st3[i+j]用0,1表示;
//状态转移方程:若s[i-1][j],s[i][j-1]都为0,则s[i][j]为0;
//若s[i-1][j] ==1;且st3[i+j] == st1[i],则s[i][j] = 1;
//若s[i][j-1] == 1;且st3[i+j] == st2[j],则s[i][j] = 1;
//初始化,s[0][0] = 1;
//s[i][0]表示st1[]的前i个字符是否都与st3[i]相符,相符则为1,否则为0;
//s[0][i]表示st2[]的前i个字符是否都与st3[i]相符,相符则为1,否则为0;
#include <iostream>
#include <string>
using namespace std;
char st1[205],st2[205],st3[405];
int len1,len2, len3;
bool s[205][205];
int main()
{
int test;
scanf("%d", &test);
for (int index = 1; index <= test; ++index) {
scanf("%s %s %s", &st1[1], &st2[1], &st3[1]);
len1 = strlen(&st1[1]);
len2 = strlen(&st2[1]);
len3 = strlen(&st3[1]);
if (len1 + len2 != len3) {
printf("Data set %d: no\n", index);
continue;
}
//
memset(s, 0, sizeof(s));
s[0][0] = 1;
int f = 1, i, j;
for (i = 1;i <= len1; ++i) {
if (f && st1[i]==st3[i])
s[i][0] = 1;
else {
s[i][0] = 0;
f = 0;
}
}
f =1;
for (j = 1; j <= len2; ++j) {
if (f && st2[j]==st3[j])
s[0][j] = 1;
else {
s[0][j] = 0;
f = 0;
}
}
//dp
for (i = 1; i <= len1; ++i)
for (j = 1; j <= len2; ++j) {
if (s[i-1][j]==0 && s[i][j-1]==0)
s[i][j] = 0;
else if (s[i-1][j]) {
if (st3[i+j] == st1[i])
s[i][j] = 1;
}
else if (s[i][j-1]) {
if (st3[i+j] == st2[j])
s[i][j] = 1;
}
}
if (s[len1][len2])
printf("Data set %d: yes\n", index);
else
printf("Data set %d: no\n",index);
}
return 0;
}