#include #define rep(i, ss, ee) for (int i = ss; i < ee; ++i) using namespace std; using P = pair; using PP = pair; void solve() { int N; double a, b; cin >> N; vector v(N); rep(i, 0, N) { cin >> a >> b; v[i].first = a / b; v[i].second.first = a; v[i].second.second = b; } sort(begin(v), end(v), greater{}); for (auto p : v) cout << p.second.first << " " << p.second.second << endl; } int main() { cin.tie(0); ios::sync_with_stdio(false); solve(); getchar(); }