#include using namespace std; using ll = long long; using ull = unsigned long long; void solve() { ull n, a, b; cin >> n >> a >> b; if (a != n / b) { cout << "NO" << "\n"; return; } string n_str = to_string(n); ull k = n_str.length() / 2; string a_str = to_string(a); string b_str = to_string(b); if ((a_str.length() != k) || (b_str.length() != k)) { 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"; } int main() { ios::sync_with_stdio(0); cin.tie(0); int t; cin >> t; while (t--) { solve(); } return 0; }