#include <stdio.h>
#include <vector>
#include <algorithm>
#include <string>
#include <ctime>
#include <cstdlib>
#include <cassert>
#include <cmath>
#include <iostream>

struct Pair {
    double coeff, cost; 
    
    int id;
};

bool operator ==(const Pair& a, const Pair& b) {
    return a.coeff == b.coeff && a.cost == b.cost;
}


// Генерация теста на n элементов:
std::vector<Pair> gen(const int n) {
    std::vector<Pair> arr;
    arr.resize(n);
    for (int i = 0; i < n; ++i) {
        arr[i].coeff = 1LL * std::rand() * std::rand() % 10000000 * 1e-6;
        arr[i].cost = std::rand() % 100 + 1;
        arr[i].id = i+1;
    }
    return arr;
}

// Неправильное решение:
std::vector<Pair> solve1(std::vector<Pair> arr) {
    std::stable_sort(arr.begin(), arr.end(), [](const Pair& a, const Pair& b){
        return (a.coeff-1) / a.cost > (b.coeff-1) / b.cost;
    });
    return arr;
}

// Правильное решение:
std::vector<Pair> solve2(std::vector<Pair> arr) {
    std::stable_sort(arr.begin(), arr.end(), [](const Pair& a, const Pair& b) {
        const int Ai = (a.coeff < 1) - (a.coeff > 1);
        const int Aj = (b.coeff < 1) - (b.coeff > 1);
        if (Ai != Aj) {
            return Ai < Aj;
        }
        if (Ai == 0 && Aj == 0) {
            return false;
        }
        return a.cost / (a.coeff - 1) < b.cost / (b.coeff - 1);
    });
    return arr;
}

std::vector<Pair> input() {
    int n; scanf("%d %*d", &n);
    
    std::vector<Pair> arr(n);
    for (int i = 0; i < n; ++i) {
        scanf("%lf %lf", &arr[i].coeff, &arr[i].cost);
        arr[i].id = i+1;
    }
    return arr;
}

bool equal(const std::vector<Pair>& arr1, const std::vector<Pair>& arr2) {
    if (arr1 == arr2) {
        return true;
    }

    long double sum1 = 0;
    for (auto& it : arr1) {
        (sum1 *= it.coeff) -= it.cost;
    }

    long double sum2 = 0;
    for (auto& it : arr2) {
        (sum2 *= it.coeff) -= it.cost;
    }
    
    return std::abs(sum1 - sum2) < 1e-18L;
}

int main() {
    std::srand(std::time(0));
    //gen();
    auto arr = input();
    auto arr1 = solve1(arr);
    auto arr2 = solve2(arr);
    assert(equal(arr1, arr2));
    for (auto& it : arr1) {
        printf("%d\n", it.id);
    }
    
    return 0;
}