#include<bits/stdc++.h>
using namespace std;
bool cmp(pair<int,int> p1,pair<int,int> p2){
int prod1 = p1.first * p1.second;
int prod2 = p2.first * p2.second;
return prod1 > prod2 || (prod1 == prod2 && p1.first > p2.first);
}
int32_t main(){
vector<pair<int,int>> vp;
vp.push_back({2,5});
vp.push_back({5,10});
vp.push_back({3,6});
vp.push_back({6,3});
sort(vp.begin(),vp.end(),cmp);
for(auto p : vp){
cout << p.first << " " << p.second << '\n';
}
return 0;
}
I2luY2x1ZGU8Yml0cy9zdGRjKysuaD4KdXNpbmcgbmFtZXNwYWNlIHN0ZDsKCmJvb2wgY21wKHBhaXI8aW50LGludD4gcDEscGFpcjxpbnQsaW50PiBwMil7CgogIGludCBwcm9kMSA9IHAxLmZpcnN0ICogcDEuc2Vjb25kOwogIGludCBwcm9kMiA9IHAyLmZpcnN0ICogcDIuc2Vjb25kOwoKICByZXR1cm4gcHJvZDEgPiBwcm9kMiB8fCAocHJvZDEgPT0gcHJvZDIgJiYgcDEuZmlyc3QgPiBwMi5maXJzdCk7Cgp9CgppbnQzMl90IG1haW4oKXsKICAKICAgIHZlY3RvcjxwYWlyPGludCxpbnQ+PiB2cDsKICAgIHZwLnB1c2hfYmFjayh7Miw1fSk7CiAgICB2cC5wdXNoX2JhY2soezUsMTB9KTsKICAgIHZwLnB1c2hfYmFjayh7Myw2fSk7CiAgICB2cC5wdXNoX2JhY2soezYsM30pOwoKICAgIHNvcnQodnAuYmVnaW4oKSx2cC5lbmQoKSxjbXApOwoKICAgIGZvcihhdXRvIHAgOiB2cCl7CiAgICAgIGNvdXQgPDwgcC5maXJzdCA8PCAiICIgPDwgcC5zZWNvbmQgPDwgJ1xuJzsKICAgIH0KCiAgICByZXR1cm4gMDsKfSA=