#include #include #include #include using namespace std; int main() { int n; cin >> n; vector> AB(n); for (pair& i : AB) cin >> i.first >> i.second; sort(AB.begin(), AB.end(), [](pair& a, pair& b)->bool { return a.first * b.second > a.second * b.first; }); for (pair& i : AB) cout << i.first << ' ' << i.second << endl; }