n= int(input().strip()) #strip()方法用于移除字符串头尾指定的字符(默认为空格或换行符)或字符序列
result = []
for i in range(n):
t = input().strip()
if "x" in t:
t = t.replace("x","*") #把小写字母x变为乘法运算符*
if "/" in t:
t = t.replace("/","//") #把/变为整除//
if eval(t) == 24:
result.append("Yes")
else:
result.append("No")
print("\n".join(result)) #将换行插入到运算结果序列中的元素间