> t;
cin.ignore();
cin.ignore(); //輸入完T會多輸入一個\n
while(t--){
string input;
multimap#include <iostream>
#include <fstream>
#include <map>
#include <algorithm>
using namespace std;
int main(){
fstream file;
file.open("output.txt");
fclose(fopen("output.txt", "w"));
int t;
cin >> t;
cin.ignore();
cin.ignore(); //輸入完T會多輸入一個\\n
while(t--){
string input;
multimap<string, string> m; //<原字串, 處理完空白+排序後的字串>
while(getline(cin, input)){
if(input == "")break;
string temp = "";
for(auto a : input){ //空白處理
if(a != ' ')
temp += a;
}
sort(temp.begin(), temp.end());
m.insert(make_pair(input, temp));
}
bool flag = false;
for(auto a = m.begin(); a != m.end(); a++){
for(auto b = a; b != m.end();){
b++;
if(b == m.end())break;
if(a->second.length() == b->second.length()){
if(a->second == b->second){
cout << a->first << " = " << b->first << "\\n";
}
}
}
}
if(t)
cout << "\\n";
}
return 0;
}