#include using namespace std; #define ld long double #define ll long long int nDigs(ll n) { int ans = 0; while (n > 0) { n /= 10; ans++; } return ans; } ll n, a, b; void solve() { cin >> n >> a >> b; if (n != a * b) { cout << "NO\n"; return; } int nDa = nDigs(a); int nDb = nDigs(b); int nDn = nDigs(n); if (2*nDa != nDn || 2*nDb != nDn) { cout << "NO\n"; return; } if (a % 10 == 0 && b % 10 == 0) { cout << "NO\n"; return; } string common = ""; while (a > 0) { common.push_back((char)((a % 10) + '0')); a /= 10; } while (b > 0) { common.push_back((char)((b % 10) + '0')); b /= 10; } string need = ""; while (n > 0) { need.push_back((char)((n % 10) + '0')); n /= 10; } sort(common.begin(), common.end()); sort(need.begin(), need.end()); if (common == need) cout << "YES\n"; else cout << "NO\n"; } int main() { ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0); int t; cin >> t; for (int i = 1; i <= t; i++) { solve(); } return 0; }