#include #include using namespace std; void solve(){ string n, a, b; cin >> n >> a >> b; long n_ = stol(n); long a_ = stol(a); long b_ = stol(b); if (a_ * b_ != n_) { cout << "NO" << endl; return; } const int n2 = (int)(n.length()) / 2; if ((a.length() != n2 && b.length() != n2) || (n.length() % 2) == 1){ cout << "NO" << endl; return; } map word; for (auto c: n){ word[c]++; } if (a[a.length() - 1] == '0' && b[b.length() - 1] == '0'){ cout << "NO" << endl; return; } for (auto c : a){ if (word.find(c) == word.end()){ cout << "NO" << endl; return; } auto cnt = word[c]; if (cnt == 0) { cout << "NO" << endl; return; } word[c]--; } for (auto c: b){ if (word.find(c) == word.end()){ cout << "NO" << endl; return; } auto cnt = word[c]; if (cnt == 0) { cout << "NO" << endl; return; } word[c]--; } for (auto item : word){ if (item.second != 0){ cout << "NO" << endl; return; } } cout << "YES" << endl; } int main() { int t; cin >> t; while (t--) solve(); return EXIT_SUCCESS; }