#include <iostream>
using namespace std;
int main(){
int count1 = 0;
int count2;
char Insert;
char mAsc[3]="";
cin >> count1;
while (count1--)
{
count2 = 3;
while (count2--)
{
cin >> mAsc[count2];
}
//简单的冒泡排序
for (int i=0;i<3;i++)
{
for (int j=i+1;j<3;j++)
{
if (mAsc[i]>mAsc[j])
{
Insert = mAsc[i];
mAsc[i] = mAsc[j];
mAsc[j]=Insert;
}
}
}
for (int m=0;m<3;m++)
{
cout << mAsc[m] << " ";
}
cout <<endl;
}
return true;
}