#include <bits/stdc++.h>
using namespace std;
int main()
{
int n;
cin>>n;
for(int i=0;i<n;i++)
{
stack<int> nums;//参与运算的数字
string str;//运算式
cin>>str;
int flag=1;//负号标志位
for(int j=0;j<7;j++)
{
if(str[j]>='0' && str[j]<='9')
{
nums.push(flag*(str[j]-'0'));
flag=1;//每次flag都要归位
}
else if(str[j]=='x')//如果是乘法,则取出前后两数相乘
{
int a=nums.top();
nums.pop();
int b=str[++j]-'0';
nums.push(a*b);
}
else if(str[j]=='/')//如果是除法,则取出前后两数相乘
{
int a=nums.top();
nums.pop();
int b=str[++j]-'0';
nums.push(a/b);
}
else if(str[j]=='-')//如果是减号,则把后一位置为负数
{
flag=-1;
}
}
int sum=0;
while(!nums.empty())
{
sum+=nums.top();
nums.pop();
}
if(sum==24)
cout<<"Yes"<<endl;
else
cout<<"No"<<endl;
}
return 0;
}
/*
10
9+3+4x3
5+4x5x5
7-9-9+8
5x6/5x4
3+5+7+9
1x1+9-9
1x9-5/9
8/5+6x9
6x7-3x6
6x4+4/5
*/