#include using namespace std; int main() { int n; cin >> n; int a[n][2]; double q[n]; int d[n]; for (int i = 0; i < n; i++) d[i] = i; for (int i = 0; i < n; i++) { cin >> a[i][0] >> a[i][1]; q[i] = a[i][0] / (double)a[i][1]; } for (int i = 0; i < n-1; i++) { for (int j = i+1; j < n; j++) { if(q[i] < q[j]) { swap(q[i], q[j]); swap(d[i], d[j]); } } } for(int i = 0; i < n; i++) { cout << a[d[i]][0] << " " << a[d[i]][1] << endl; } return 0; }