#include
#include
#include
#include
#include
using namespace std;
class Stick
{
public:
int length, weight;
Stick()
{
length = 0;
weight = 0;
}
bool operator<(Stick& stick)
{
/*
测试数据为
1
5
3 1 1 3 1 4 3 1 4 2
当(3,1)和(3,1)比较时会说我的<重载无效
但是改为注释部分代码后就OK了?(两者只有等号的位置不同----我知道意思不同但是也不至于报错呀)
/
if (length>stick.length)return false;
else if (length <=stick.length) return true;
/
if (length>=stick.length)return false;
else if (length <stick.length) return true;
*/
}
};
int main()
{
ios::sync_with_stdio(false);
int t, n, cnt;
Stick temp;
vector<Stick>vec;
cin >> t;
while (t--)
{
vec.clear();
cin >> n;
for (int i = 0; i < n; i++)
{
cin >> temp.length >> temp.weight;
vec.push_back(temp);
}
sort(vec.begin(),vec.end());
for (int i = 0; i < n; i++)
cout <<vec[i].length << " " <<vec[i].weight << endl;
}
system("pause");
return 0;
}