#include<bits/stdc++.h>
using namespace std;
const int N = 500000;
int n;
char s[220];
stack<int>st;
int main(){
int len,x,y;
scanf("%d",&n);
while(n--){
while(!st.empty())
st.pop();
scanf("%s",s);
len = strlen(s);
int i = 0;
while(i < len){
if (isdigit(s[i])) st.push(s[i] - '0');
else {
if (s[i] == '+'){
i++;
st.push(s[i] - '0');
} else if (s[i] == '-'){
i++;
st.push(-(s[i]-'0'));
} else if (s[i] == '/'){
x = st.top(); st.pop();
i++;
y = s[i] - '0';
st.push(x / y);
} else if(s[i] == 'x'){
x = st.top(); st.pop();
i++;
y = s[i] - '0';
st.push(x * y);
}
}
i++;
}
while(st.size() != 1){
y = st.top(); st.pop();
x = st.top(); st.pop();
st.push(x + y);
}
printf(st.top() == 24?"Yes\n":"No\n");
}
return 0;
}
/*
10
9+3+4*3
5+4*5*5
4*6+4/5
*/