#include <bits/stdc++.h>
using namespace std;
using ll = long long;
int main() {
ll n;
cin >> n;
ll d;
cin >> d;
map <pair<ll, ll>, ll> s;
for (ll i = 0; i < n; ++i) {
ll x;
cin >> x;
ll y;
cin >> y;
s[{x, y}] = i + 1;
}
ll left_x = (*s.begin()).first.first;
ll left_y = (*s.begin()).first.second;
ll right_x = (*s.begin()).first.first;
ll right_y = (*s.begin()).first.second;
deque <ll> deq;
deq.push_front((*s.begin()).second);
s.erase(s.begin());
while (!s.empty()) {
ll x;
ll y;
for (auto [key, count] : s) {
x = key.first;
y = key.second;
if (sqrt((left_x - x) * (left_x - x) + (left_y - y) * (left_y - y)) == d) {
deq.push_front(count);
s.erase(s.find(key));
left_x = x;
left_y = y;
if (s.empty()) {
break;
}
continue;
}
if (sqrt((right_x - x) * (right_x - x) + (right_y - y) * (right_y - y)) == d) {
deq.push_back(count);
s.erase(s.find(key));
right_x = x;
right_y = y;
if (s.empty()) {
break;
}
continue;
}
}
}
while (!deq.empty()) {
cout << deq.front() << ' ';
deq.pop_front();
}
}