#include #include #include #include #include #include using namespace std; int main() { int tc; cin >> tc; long long a, b, n; for (int i = 0; i < tc; i++) { cin >> n >> a >> b; // 1. if (a * b != n) { cout << "NO" << "\n"; continue; } // 2 size_t l = to_string(a).length(); size_t r = to_string(b).length(); if (l != r) { cout << "NO" << "\n"; continue; } if (to_string(n).length() != l + r) { cout << "NO" << "\n"; continue; } // 3 if (a % 10 == 0 && b % 10 == 0) { cout << "NO" << "\n"; continue; } // 4. int nums[10]; memset(nums, 0, sizeof(nums)); long long x = a; while (x) { ++nums[x % 10]; x /= 10; } x = b; while (x) { ++nums[x % 10]; x /= 10; } x = n; while (x) { --nums[x % 10]; x /= 10; } bool valid = true; for (int j = 0; j < 10; ++j) { if (nums[j] != 0) { cout << "NO" << "\n"; valid = false; break; } } if (valid == false) { continue; } cout << "YES" << "\n"; } return 0; }