#include <bits/stdc++.h>
using namespace std;
#define int long long

int N;
double a,b;
std::vector<pair<double,pair<double,double> > > v;

signed main(){
    std::cin >> N;
    for(int i = 0 ; i < N ; i++){
            std::cin >> a >> b;
            v.push_back(pair<double,pair<double,double>>(a/b,pair<double,double>(a,b)));
    }

    sort(v.begin(),v.end());
    reverse(v.begin(),v.end());

    for(auto &e : v){
        std::cout << e.second.first << " " << e.second.second << '\n';
    }
    
    return 0;
}