#include using namespace std; #define int long long #define FOR(i, s, n) for (int i = (s); i < (n); i++) #define RFOR(i, s, n) for (int i = (n) - 1; i >= (s); i--) #define REP(i, n) FOR(i, 0, n) #define RREP(i, n) RFOR(i, 0, n) #define ALL(a) a.begin(), a.end() const long long MOD = 1e9 + 7, INF = 1e18; templateinline bool CHMAX(T&a,T b){if(ainline bool CHMIN(T&a,T b){if(a>b){a=b;return true;}return false;} signed main(){ int N; cin >> N; vectora(N),b(N); vectorid(N); REP(i,N)cin >> a[i] >> b[i]; iota(ALL(id),0); sort(ALL(id),[&](int l,int r){ return a[l]/b[l] > a[r]/b[r]; }); REP(i,N){ cout << a[id[i]] << " " << b[id[i]] << endl; } }