import java.util.Scanner;

public class Vampires {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int tests = sc.nextInt();
        for (int i = 0; i < tests; i++) {
            int n = sc.nextInt();
            int a = sc.nextInt();
            int b = sc.nextInt();

            if (n != a * b){
                System.out.println("NO");
                continue;
            }

            if (a%10 == 0 && b%10 == 0){
                System.out.println("NO");
                continue;
            }
            if(sameDigits(n, a, b)){
                System.out.println("YES");
            } else {
                System.out.println("NO");
            }

        }
    }

    private static boolean sameDigits(int n, int a, int b) {
        int[] hist = new int[10];
        while(n > 0){
            hist[n%10]++;
            n /= 10;
        }
        while(a > 0){
            hist[a%10]--;
            a /= 10;
        }
        while(b > 0){
            hist[b%10]--;
            b /= 10;
        }
        for (int i = 0; i < 10; i++) {
            if (hist[i] != 0){
                return false;
            }
        }
        return true;
    }
}
