#include using namespace std; int main() { ios::sync_with_stdio(false); cin.tie(0); int N; cin >> N; vector>> X(N); for (int i = 0; i < N; i++) { int a, b; cin >> a >> b; X[i] = make_pair((double)a / b, make_pair(a, b)); } sort(X.begin(), X.end()); reverse(X.begin(), X.end()); for (int i = 0; i < N; i++) { cout << X[i].second.first << ' ' << X[i].second.second << '\n'; } return 0; }