#include using namespace std; int main() { int n; cin >> n; vector> v(n, vector(3, 0)); for (int i = 0; i < n; i++) { for (int j = 1; j < 3; j++) { cin >> v.at(i).at(j); } v.at(i).at(0) = v.at(i).at(1) / v.at(i).at(2); } sort(v.begin(), v.end()); reverse(v.begin(), v.end()); for (int i = 0; i < n; i++) { for (int j = 1; j < 3; j++) { cout << v.at(i).at(j); if (j == 1) { cout << ' '; } else { cout << endl; } } } }