#include using namespace std; int main() { int n; cin >> n; vector> a(n); for (int i = 0; i < n; i++) { cin >> a[i].first >> a[i].second; } auto f = [] (auto x, auto y) { return (double)x.first / x.second > (double)y.first / y.second; }; sort(a.begin(), a.end(), f); for (const auto& p : a) { cout << p.first << " " << p.second << endl; } return 0; }