#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
using namespace std;
int main(void)
{
int t;
cin >> t;
while (t--)
{
string a; //문장 입력
cin >> a;
vector <string> b; //결과 저장
for (int i = 0; i < a.length(); i += 2) //2단어씩 묶어서 벡터에 저장
{
string temp(1, a[i]); //첫 번째 단어 문자열로 저장
temp += a[i + 1]; //두 번째 단어 추가
b.push_back(temp); //2단어를 문장으로 벡터에 저장
}
sort(b.begin(), b.end()); //오름차순 정렬
for (int i = 0; i < b.size(); i++) //출력
cout << b[i];
cout << endl;
}
}
I2luY2x1ZGUgPGlvc3RyZWFtPgojaW5jbHVkZSA8YWxnb3JpdGhtPgojaW5jbHVkZSA8c3RyaW5nPgojaW5jbHVkZSA8dmVjdG9yPgoKdXNpbmcgbmFtZXNwYWNlIHN0ZDsKCmludCBtYWluKHZvaWQpCnsKCWludCB0OwoJY2luID4+IHQ7CgoJd2hpbGUgKHQtLSkKCXsKCQlzdHJpbmcgYTsJCQkvL+usuOyepSDsnoXroKUKCQljaW4gPj4gYTsKCQl2ZWN0b3IgPHN0cmluZz4gYjsJLy/qsrDqs7wg7KCA7J6lCgoJCWZvciAoaW50IGkgPSAwOyBpIDwgYS5sZW5ndGgoKTsgaSArPSAyKQkvLzLri6jslrTslKkg66y27Ja07IScIOuyoe2EsOyXkCDsoIDsnqUKCQl7CgkJCXN0cmluZyB0ZW1wKDEsIGFbaV0pOwkvL+yyqyDrsojsp7gg64uo7Ja0IOusuOyekOyXtOuhnCDsoIDsnqUKCQkJdGVtcCArPSBhW2kgKyAxXTsJCS8v65GQIOuyiOynuCDri6jslrQg7LaU6rCACgoJCQliLnB1c2hfYmFjayh0ZW1wKTsJCS8vMuuLqOyWtOulvCDrrLjsnqXsnLzroZwg67Kh7YSw7JeQIOyggOyepQoJCX0KCgkJc29ydChiLmJlZ2luKCksIGIuZW5kKCkpOwkvL+yYpOumhOywqOyInCDsoJXroKwKCgkJZm9yIChpbnQgaSA9IDA7IGkgPCBiLnNpemUoKTsgaSsrKQkvL+y2nOugpQoJCQljb3V0IDw8IGJbaV07CgkJY291dCA8PCBlbmRsOwoJfQp9