package ncu.edu.ccf;
import java.util.Scanner;
public class ErShiSiDian {
static Scanner sc = new Scanner(System.in);
public static void main(String[] args) {
// TODO Auto-generated method stub
int n = sc.nextInt();
int num[] = new int[7];//****
for(int i = 0; i < n; i++) {
String s = sc.next();//读入一行数据,读入字符串
for(int m = 0; m < 7; m++) {
num[m] = s.charAt(m);//检索字符串s中m位置的字符
}
for(int j = 0; j <= 4; j += 2) {
if(num[j+1] == 'x' ||num[j+1] == '/') {
num[j+2] = '0' + way(num[j], num[j+2], num[j+1]);
num[j] = '0';
num[j + 1] = j==0?'+':num[j-1];
}
}
for (int k = 0; k <= 4; k += 2) {
if (num[k + 1] == '+' || num[k + 1] == '-') {
num[k + 2] = '0' + way(num[k], num[k + 2], num[k + 1]);
}
}
if (num[6] == '0' + 24) {
System.out.println("Yes");
} else {
System.out.println("No");
}
}
}
static int way(int a, int b, int operator) {
int a1 = a - '0';//将char类型转换成int类型
int b1 = b - '0';
switch (operator) {
case '+':
return a1 + b1;
case '-':
return a1 - b1;
case 'x':
return a1 * b1;
case '/':
return a1 / b1;
}
return 0;
}
}