#include using namespace std; using ll = long long; using ull = unsigned long long; ll MOD = 1'000'000'007; signed main() { ll tt; cin >> tt; while(tt--) { ll n, a, b; cin >> n >> a >> b; ll ln = (ll)(log10l(n)) + 1; ll la = (ll)(log10l(a)) + 1; ll lb = (ll)(log10l(b)) + 1; if (a * b == n) { if (lb == ln / 2 && la == ln / 2) { if (a % 10 != 0 || b % 10 != 0) { set s; while (n) { s.insert(n % 10); n /= 10; } while (a) { if (s.find(a % 10) != s.end()) s.erase(s.find(a % 10)); else break; a /= 10; } while (b) { if (s.find(b % 10) != s.end()) s.erase(s.find(b % 10)); else break; b /= 10; } if (a == 0 && b == 0) cout << "YES" << '\n'; else cout << "NO" << '\n'; } else cout << "NO" << '\n'; } else cout << "NO" << '\n'; } else cout << "NO" << '\n'; } }