#include using namespace std; using ll = long long; using vi = vector; int main() { ios_base::sync_with_stdio(false); cin.tie(nullptr); int t; cin >> t; for (int i = 1; i <= t; i++) { string big, small1, small2; cin >> big >> small1 >> small2; int ibig, ismall1, ismall2; ibig = stoi(big); ismall1 = stoi(small1); ismall2 = stoi(small2); ll k = big.size() / 2; if (ibig != ismall1 * ismall2) { cout << "NO" << "\n"; continue; } if (small1.size() != k || small2.size() != k) { cout << "NO" << "\n"; continue; } if (!(ismall1 % 10 != 0 || ismall2 % 10 != 0)) { cout << "NO" << "\n"; } string con = string(small1 + small2); if (is_permutation(big.begin(), big.end(), con.begin(), con.end())) { cout << "YES" << "\n"; } else { cout << "NO" << "\n"; } } return 0; }