#include <stdio.h>
#include <string.h>
char *num[11] = {"zero","one","two","three","four","five","six","seven","eight","nine","ten"};
char* compareChar(char* s1, char* s2){
int i=0, j;
while(s1[i]){
j=0;
while(s2[j]){
if(s1[i]==s2[j]){
//printf(">%c %d %s\n", s1[i], j, s2);
s2[j] = '-';
break;
}
j++;
}
//printf(">>%s\n", s2);
if(!s2[j]) return "No";
i++;
}
//printf(">>>%s\n", s2);
if(s2[i]) return "No";
return "Yes";
}
int getN(char* s){
int i;
for(i=0; i<11; i++){
//printf(">>>%s = %d\n", s, i);
return i;
}
}
return -1;
}
int main() {
int n, i, j, r, t;
char a[11], b[11], c[11], op[2],e[2];
while(n--){
scanf("%s%s%s%s%s", a
,op
,b
,e
,c
); r = getN(a);
t=getN(b);
if(op[0]=='+') r+=t;
else if(op[0]=='-') r-=t;
else if(op[0]=='*') r*=t;
else r/=t;
if(r
<0 || r
>11) printf("No\n"); else printf("%s\n", compareChar
(num
[r
], c
)); }
return 0;
}
// int getN(char* s){
// if(!strcmp(s,"zero")) return 0;
// if(!strcmp(s,"one")) return 1;
// if(!strcmp(s,"two")) return 2;
// if(!strcmp(s,"three")) return 3;
// if(!strcmp(s,"four")) return 4;
// if(!strcmp(s,"five")) return 5;
// if(!strcmp(s,"six")) return 6;
// if(!strcmp(s,"seven")) return 7;
// if(!strcmp(s,"eight")) return 8;
// if(!strcmp(s,"nine")) return 9;
// if(!strcmp(s,"ten")) return 10;
// return -1;
// }
// char* getS(int n){
// if(n==0) return "zero";
// if(n==1) return "one";
// if(n==2) return "two";
// if(n==3) return "three";
// if(n==4) return "four";
// if(n==5) return "five";
// if(n==6) return "six";
// if(n==7) return "seven";
// if(n==8) return "eight";
// if(n==9) return "nine";
// if(n==10) return "ten";
// return "!";
// }
// int main() {
// int n, i, j, r, t;
// char a[11], b[11], c[11], op[2],e[2];
// scanf("%d",&n);
// while(n--){
// scanf("%s%s%s%s%s", a,op,b,e,c);
// r = getN(a);
// t=getN(b);
// if(op[0]=='+') r+=t;
// else if(op[0]=='-') r-=t;
// else if(op[0]=='*') r*=t;
// else r/=t;
// printf("%s\n", compareChar(getS(r), c));
// }
// return 0;
// }
I2luY2x1ZGUgPHN0ZGlvLmg+CiNpbmNsdWRlIDxzdHJpbmcuaD4KY2hhciAqbnVtWzExXSA9IHsiemVybyIsIm9uZSIsInR3byIsInRocmVlIiwiZm91ciIsImZpdmUiLCJzaXgiLCJzZXZlbiIsImVpZ2h0IiwibmluZSIsInRlbiJ9OwpjaGFyKiBjb21wYXJlQ2hhcihjaGFyKiBzMSwgY2hhciogczIpewoJaW50IGk9MCwgajsKCXdoaWxlKHMxW2ldKXsKCQlqPTA7CgkJd2hpbGUoczJbal0pewoJCQlpZihzMVtpXT09czJbal0pewoJCQkJLy9wcmludGYoIj4lYyAlZCAlc1xuIiwgczFbaV0sIGosIHMyKTsKCQkJCXMyW2pdID0gJy0nOwoJCQkJYnJlYWs7CgkJCX0KCQkJaisrOwoJCX0KCQkvL3ByaW50ZigiPj4lc1xuIiwgczIpOwoJCWlmKCFzMltqXSkgcmV0dXJuICJObyI7CgkJaSsrOwoJfQoJLy9wcmludGYoIj4+PiVzXG4iLCBzMik7CglpZihzMltpXSkgcmV0dXJuICJObyI7CglyZXR1cm4gIlllcyI7Cn0KaW50IGdldE4oY2hhciogcyl7CglpbnQgaTsKCWZvcihpPTA7IGk8MTE7IGkrKyl7CgkJaWYoc3RyY21wKHMsbnVtW2ldKT09MCl7CgkJCS8vcHJpbnRmKCI+Pj4lcyA9ICVkXG4iLCBzLCBpKTsKCQkJcmV0dXJuIGk7CgkJfQoJfQoJcmV0dXJuIC0xOwp9CmludCBtYWluKCkgewoJaW50IG4sIGksIGosIHIsIHQ7CgljaGFyIGFbMTFdLCBiWzExXSwgY1sxMV0sIG9wWzJdLGVbMl07CgoJc2NhbmYoIiVkIiwmbik7Cgl3aGlsZShuLS0pewoJCXNjYW5mKCIlcyVzJXMlcyVzIiwgYSxvcCxiLGUsYyk7CgkJciA9IGdldE4oY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