#include using namespace std; using ll = long long; using ull = unsigned long long; void solve() { ll n, b, a; cin >> n >> a >> b; if(n / b != a || n / a != b) { cout << "NO" << "\n"; return; } string nstr = to_string(n); string astr = to_string(a); string bstr = to_string(b); ll nlen = nstr.length(); ll blen = bstr.length(); ll alen = astr.length(); if (nlen % 2 != 0) { cout << "NO" << "\n"; return; } if (nlen != alen + blen) { cout << "NO" << "\n"; return; } if (alen != blen) { cout << "NO" << "\n"; return; } if ((a % 10 == 0) && (b % 10 == 0)) { cout << "NO" << "\n"; return; } vector freq(10); while (a != 0) { ++freq[a % 10]; a /= 10; } while (b != 0) { ++freq[b % 10]; b /= 10; } while (n != 0) { --freq[n % 10]; n /= 10; } for (ll i : freq) { if (i != 0) { cout << "NO" << "\n"; return; } } cout << "YES" << "\n"; return; } int main() { ios::sync_with_stdio(0); cin.tie(0); int t; cin >> t; while (t--) { solve(); } return 0; }