#include #include using namespace std; typedef long long ll; int count_digs (ll a, vector& v) { int k = 0; while (a>0) { int d = a%10; a/=10; v[d]++; k++; } return k; } signed main() { int n; cin >> n; for (int i=0; i> j >> a >> b; if (a > j) { cout << "NO" << '\n'; continue; } if (b > j) { cout << "NO" << '\n'; continue; } if (j != a*b) { //cout << 1 << endl; cout << "NO" << '\n'; continue; } if (a%10 == 0 && b%10 == 0) { //cout << 2 << endl; cout << "NO" << '\n'; continue; } vector digs(10, 0); vector other_digs(10, 0); auto k = count_digs(j, digs); auto ak = count_digs(a, other_digs); auto bk = count_digs(b, other_digs); //cout << k << ' ' << ak << ' ' << bk << endl; if (k % 2 != 0 || ak != bk || ak != k/2) { //cout << 3 << endl; cout << "NO" << '\n'; continue; } for (int i=0; i<10; i++) { //cout << digs[i] << ' ' << other_digs[i] << endl; if (digs[i] != other_digs[i]) { //cout << 4 << endl; cout << "NO" << '\n'; goto end; } } cout << "YES" << '\n'; end: cout.flush(); } }