#include<bits/stdc++.h>
using namespace std;
using ll = long long;
using ull = unsigned long long;

void countDigits(vector<int>& counts, ull n, int digits) {
	for (int i = 0; i < digits; i++) {
		int digit = n % 10;
		counts[digit]++;
		n /= 10;
	}
}

int main() {
	ios::sync_with_stdio(false); cin.tie(nullptr);


	int t;
	cin >> t;
	for (int i = 0; i < t; ++i) {
		ull n, a, b;
		cin >> n >> a >> b;

//		ull n, a, b;
//		// find n, a, b
//		if (x > y && x > z) {
//			n = x;
//			a = y;
//			b = z;
//		}
//		else if (y > x && y > z) {
//			n = y;
//			a = x;
//			b = z;
//		}
//		else if (z > x && z > y) {
//			n = z;
//			a = x;
//			b = y;
//		}
//
//		printf("n = %lld, a = %lld, b = %lld\n", n, a, b);


		int ndigits = log10(n ) + 1;
		int adigits = log10(a ) + 1;
		int bdigits = log10(b ) + 1;

//		printf("ndigits = %d, adiigts = %d, bdgits = %d\n", ndigits, adigits, bdigits);

		bool res = true;
		if (adigits != bdigits || ndigits != 2*adigits) {
//			printf("prvni if\n");	
			res = false;
		} else if (a % 10 == 0 && b % 10 == 0) {
//			printf("druhy if (delitelnist)\n");	
			res = false;
		} else if (a * b != n) {
//			printf("treti if (nasobeni)\n");	
			res = false;
		} else {
			// compute permutations
			vector<int> abDigitCnts(10);
			vector<int> nDigitCnts(10);


			countDigits(abDigitCnts, a, adigits);
			countDigits(abDigitCnts, b, bdigits);
			countDigits(nDigitCnts, n, ndigits);


//			for (int i = 0; i < 10; i++) {
				//printf("digit %d - ab: %d, n: %d\n", i, abDigitCnts[i], nDigitCnts[i]);
			//}

			if (abDigitCnts == nDigitCnts) {
				res = true;
			} else {
				res = false;
			}
		}

		if (res) {
			cout << "YES\n";
		} else {
			cout << "NO\n";
		}

		
	}
    return 0;
}
