#include #include #include #include #include #include #include #include #include using namespace std; using ll = long long; void makeCount(const char* str, int* counts) { while (*str != '\0') { counts[*(str++) - '0'] += 1; } } int main() { cin.tie(nullptr); ios::sync_with_stdio(false); int n; cin >> n; for (int i = 0; i < n; i++) { ll big, a, b; cin >> big >> a >> b; int smallCounts[10] {}; int bigCounts[10] {}; if (a * b != big) { cout << "NO\n"; continue; } string bigStr = to_string(big); if (bigStr.length() % 2 != 0) { cout << "NO\n"; continue; } size_t k = bigStr.length() / 2; string aStr = to_string(a); string bStr = to_string(b); if (aStr.length() != k || bStr.length() != k) { cout << "NO\n"; continue; } if (a % 10 == 0 && b % 10 == 0) { cout << "NO\n"; continue; } makeCount(aStr.c_str(), smallCounts); makeCount(bStr.c_str(), smallCounts); makeCount(bigStr.c_str(), bigCounts); bool bad = false; for (int j = 0; j < 10; j++) { if (smallCounts[j] != bigCounts[j]) { cout << "NO\n"; bad = true; break; } } if (!bad) { cout << "YES\n"; } } return 0; }