#include <iostream>
using namespace std;
int x[1010];
main()
{
int n;
while(cin >> n) {
for(int i=0; i<n; i++) {
cin >> x[i];
}
// do bubble sort
}
}
#include <iostream>
#include <string>
#include <algorithm>
using namespace std;
const int MAX_M = 110;
string st[MAX_M];
pair<int,int> x[MAX_M];
int n,m;
int unsortedness(string s)
{
// TODO
// read how to work on strings here: https://cplusplus.com/reference/string/string/
// ex. try s.length() and s.at(xxx)
return 0;
}
void solve()
{
cin >> n >> m;
for(int i=0; i<m; i++) {
cin >> st[i];
x[i].first = unsortedness(st[i]);
x[i].second = i;
}
sort(x, x+m);
for(int i=0; i<m; i++) {
cout << st[x[i].second] << endl;
}
}
int main()
{
int k;
cin >> k;
for(int j=0; j<k; j++) {
solve();
}
}
#include <iostream>
#include <algorithm>
using namespace std;
pair<int,int> x[1000];
int main()
{
int n;
cin >> n;
for(int i=0; i<n; i++) {
cin >> x[i].first >> x[i].second;
}
sort(x, x+n);
for(int i=0; i<n; i++) {
cout << x[i].first << " " << x[i].second << endl;
}
}