#include #define rep(i, n) for (int i = 0; i < n; ++i) using ll = long long; using namespace std; const int INF = 1e9; struct frac { double res; int a, b; }; int main() { int N; cin >> N; vector F(N); rep(i, N) { cin >> F[i].a >> F[i].b; F[i].res = (double)F[i].a / F[i].b; } sort(F.begin(), F.end(), [](const frac &a, const frac &b) { return a.res > b.res; }); rep(i, N) cout << F[i].a <<" "<< F[i].b << endl; return 0; }