#include <bits/stdc++.h>
using namespace std;
struct __s {
  __s() {
    if (1) {
      ios_base::Init i;
      cin.sync_with_stdio(0);
      cin.tie(0);
    }
  }
  ~__s() {
    if (!1)
      fprintf(stderr, "Execution time: %.3lf s.\n",
              (double)clock() / CLOCKS_PER_SEC);
    long long n;
    cin >> n;
  }
} __S;
double Pi = acos(-1);
vector<pair<long long, long long> > v[901];
int main(void) {
  long long n;
  cin >> n;
  for (long long i = 0; i < (long long)(n); i++) {
    long long x, y;
    cin >> x >> y;
    double a = atan(1.0 * y / x) * 180.0 / Pi;
    long long j = a / 0.1;
    v[j].push_back(make_pair(x + y, i));
  }
  for (long long i = 0; i < (long long)(901); i++) {
    sort(v[i].begin(), v[i].end());
  }
  bool k = 1;
  for (long long i = 0; i < (long long)(901); i++) {
    if (v[i].size() == 0) continue;
    if (k) reverse(v[i].begin(), v[i].end());
    for (long long j = 0; j < (long long)(v[i].size()); j++) {
      cout << v[i][j].second + 1 << " ";
    }
    k = !k;
  }
  return 0;
}
