#include using namespace std; #define REP(i,a,n) for(int i=(a); i<(int)(n); i++) #define rep(i,n) REP(i,0,n) #define FOR(it,c) for(__typeof((c).begin()) it=(c).begin(); it!=(c).end(); ++it) #define ALLOF(c) (c).begin(), (c).end() typedef long long ll; typedef unsigned long long ull; struct F { bool flg; int a, b; F(int x, int y){ if(x >= 0) flg = true; else flg = false; a = abs(x); b = y; } }; bool operator<(const F& x, const F& y){ if(x.flg != y.flg){ if(x.flg) return false; else return true; } if(x.flg) return x.a * y.b < y.a * x.b; return x.a * y.b > y.a * x.b; } int main(){ int n; cin >> n; vector v; rep(i,n){ int a, b; cin >> a >> b; v.emplace_back(a, b); } sort(ALLOF(v)); reverse(ALLOF(v)); rep(i,v.size()){ int a = v[i].a; if(!v[i].flg) a *= -1; int b = v[i].b; cout << a << " " << b << endl; } return 0; }