#include "bits/stdc++.h" using namespace std; #define FOR(i,j,k) for(int (i)=(j);(i)<(int)(k);++(i)) #define rep(i,j) FOR(i,0,j) #define each(x,y) for(auto &(x):(y)) #define mp make_pair #define all(x) (x).begin(),(x).end() #define debug(x) cout<<#x<<": "<<(x)< pii; typedef vector vi; typedef vector vll; struct Fraction{ long long n, d; Fraction():n(0),d(1){ } Fraction(long long n_, long long d_ = 1):n(n_), d(d_){ adjust(); } bool operator<(const Fraction &x) const{ return n*x.d < x.n*d; } bool operator<=(const Fraction &x) const { return n*x.d<=x.n*d; } bool operator>(const Fraction &x) const{ return !(*this<=x); } bool operator>=(const Fraction &x) const{ return !(*this>N; vector> vf(N); rep(i, N)scanf("%lld%lld", &vf[i].first.n, &vf[i].first.d), vf[i].second = i + 1; sort(all(vf), greater>()); rep(i, N)printf("%d%c", vf[i].second, i == N - 1 ? '\n' : ' '); }