#include using namespace std; bool comp(const pair &x, const pair &y) { return x.first * y.second > x.second * y.first; } int main(){ ios::sync_with_stdio(false); cin.tie(0); int n; cin >> n; vector> a(n); for(int i = 0; i < n; i++) { cin >> a[i].first >> a[i].second; } sort(a.begin(), a.end(), comp); for(int i = 0; i < n; i++) { cout << a[i].first << " " << a[i].second << endl; } return 0; }