#include using namespace std; using ll = long long; bool process() { ll n, a ,b; cin >> n >> a >> b; // cout << a << ";" << b << ";" << n << endl; if (n != a * b) { return false; } ll k = 0; ll a_2 = a; while (a_2 > 0) { a_2 /= 10; ++k; } ll l = 0; ll b_2 = b; while (b_2 > 0) { b_2 /= 10; ++l; } ll m = 0; ll n_2 = n; while (n_2 > 0) { n_2 /= 10; ++m; } // cout << k << ";" << l << ";" << m << endl; if (k != l) { return false; } if (2 * k != m) { return false; } if (a % 10 == 0 && b % 10 == 0) { return false; } // cout << "A\n"; map count{}; a_2 = a; for (ll i = 0; i < k; ++i) { count[a_2 % 10]++; a_2 /= 10; } b_2 = b; for (ll i = 0; i < l; ++i) { count[b_2 % 10]++; b_2 /= 10; } map need{}; n_2 = n; for (ll i = 0; i < m; ++i) { need[n_2 % 10]++; n_2 /= 10; } for (auto& [ t, c ] : count) { if (c == need[t]) continue; return false; } return true; } int main() { std::ios::sync_with_stdio(false); ll t; cin >> t; for (ll i = 0; i < t; ++i) { if (process()) { cout << "YES\n"; } else { cout << "NO\n"; } } cout.flush(); return 0; }