#include using namespace std; int main() { int v[10] = {0}; int t = 0; scanf("%d", &t); char str[20]; string n, a, b; int n1, a1, b1; for (int i = 0; i < t; ++i) { scanf("%d %d %d", &n1, &a1, &b1); if (n1 < a1 || n1 < b1) { printf("NO\n"); continue; } if ((a1 % 10 == 0) && (b1 % 10 == 0)) { printf("NO\n"); continue; } string n = ""; int k = n1; while (k != 0) { n = (char)((k % 10) + '0') + n; k /= 10; } k = a1; string a = ""; while (k != 0) { a = (char)((k % 10) + '0') + a; k /= 10; } string b = ""; k = b1; while (k != 0) { b = (char)((k % 10) + '0') + b; k /= 10; } // cout << a << ' ' << a.size() << ' ' << b << ' ' << b.size() << ' ' << n << ' ' << n.size() << ' '; if ((int)a.size() + (int)b.size() != (int)n.size()) { printf("NO\n"); continue; } if ((int)a.size() != (int)b.size()) { printf("NO\n"); continue; } // printf("%s %s %s\n", a.c_str(), b.c_str(), n.c_str()); // for (int j = 0; j < n.size(); ++j) { // v[static_cast(n[j])]++; // } // a = str; // for (int j = 0; j < a.size(); ++j) { // v[static_cast(a[j])]--; // } // b = str; // for (int j = 0; j < b.size(); ++j) { // v[static_cast(b[j])]--; // } // int no = 0; // for (int j = 0; j < 10; j++) { // if (v[j] != 0) n = 1; // } // if (no != 0) { // printf("NO\n"); // continue; // } string ab = a + b; vector lll {}; vector ddd {}; for (char jwkeh : ab) lll.push_back(jwkeh); for (char jwkeh : n) ddd.push_back(jwkeh); sort(lll.begin(), lll.end()); sort(ddd.begin(), ddd.end()); if (lll != ddd) { printf("NO\n"); continue; } if (a1 * b1 != n1) { printf("NO\n"); continue; } printf("YES\n"); continue; } return 0; }