#include using namespace std; using ll = long long; using ull = unsigned long long; #define rep(i,a,b) for(int i =a; i <(b); ++i) void yesno(bool f) { cout << (f ? "YES" : "NO") << "\n"; } int get_dig(ll num) { int cnt = 0; while (num > 0) { cnt += 1; num /= 10; } return cnt; } void solve() { ull n, a, b; cin >> n >> a >> b; if (n != a*b) yesno(false); else if (get_dig(a) != get_dig(b)) yesno(false); else if (a % 10 == 0 && b % 10 == 0) yesno(false); else { int d1[10] = {0}, d2[10] = {0}; while (a > 0) { d1[a%10] += 1; a /= 10; } while (b > 0) { d1[b%10] += 1; b /= 10; } while (n > 0) { d2[n%10] += 1; n /= 10; } for (int i = 0; i <= 9; i++) { if (d1[i] != d2[i]) { yesno(false); return; } } yesno(true); } } int main() { cin.tie(0)->sync_with_stdio(0); cin.exceptions(cin.failbit); int qq; cin >> qq; while (qq--) { solve(); } return 0; }