#include using namespace std; int a[10]; int b[10]; double c[10]; int main() { int n; cin >> n; for (int i = 0; i < n; i++){ cin >> a[i]; cin >> b[i]; } for (int i = 0; i < n; i++){ c[i] = double(a[i]) / b[i]; } for (int i = 0; i < n-1; i++){ for (int j = i; j < n; j++){ if (c[i] < c[j]){ swap(c[i],c[j]); swap(a[i],a[j]); swap(b[i],b[j]); } } } for (int i = 0; i < n; i++){ cout << a[i] << " " << b[i] << "\n"; } }