#include #include #include #include #include #include #define _USE_MATH_DEFINENS #include using namespace std; #define p(x) cout << x << endl; #define el cout << endl; #define rep(i, n) for (int i = 0; i < (int)(n); i++) int main(){ cin.tie(0); ios::sync_with_stdio(false); int n; cin >> n; int a[n], b[n]; for(int i = 0; i < n; i++){ cin >> a[i] >> b[i]; } for(int i = 0; i < n; i++){ for(int j = 0; j < n; j++){ if (((float)a[j] / (float)b[j]) < ((float)a[i] / (float)b[i])){ int tmp = a[j]; a[j] = a[i]; a[i] = tmp; tmp = b[j]; b[j] = b[i]; b[i] = tmp; } } } for (int i = 0; i < n; i++){ cout << a[i] << " " << b[i] << endl;; } }