#include using namespace std; using ll = long long; const ll mod = 1e9 + 7; const ll inf = (1 << 30) - 1; const ll infll = (1LL << 61) - 1; int main() { int N; cin >> N; vector>> d(N); for (int i = 0; i < N; i++) { cin >> d[i].second.first >> d[i].second.second; d[i].first = d[i].second.first / d[i].second.second; } sort(d.rbegin(), d.rend()); for (auto a : d) { cout << a.second.first << " " << a.second.second << endl; } }