#include using namespace std; bool cmp(pair a, pair b) { return a.first * b.second > b.first * a.second; } int main() { int n; cin >> n; vector> vt; for (int i = 0; i < n; ++i) { int a, b; cin >> a >> b; vt.emplace_back(a, b); } sort(vt.begin(), vt.end(), cmp); for (auto x:vt) { cout << x.first << " " << x.second << endl; } return 0; }