#include <bits/stdc++.h>
struct Point {
int r, c;
};
auto compPoint = [](Point a, Point b) {
return std::make_pair(a.r, a.c) < std::make_pair(b.r, b.c);
};
std::pair<int, int> dxy[8] = {{-1, -1}, {-1, 0}, {-1, 1}, {0, 1}, {1, 1}, {1, 0}, {1, -1}, {0, -1}};
int main() {
int N, T;
std::cin >> N >> T;
std::vector<Point> sks(N);
for (auto &[r, c] : sks) {
std::cin >> r >> c;
}
std::map<Point, int, decltype(compPoint)> skMap(compPoint);
for (int i = 0; i < N; ++i) {
skMap[sks[i]] = i;
}
std::vector<bool> isSeen(N);
std::vector<int> answer;
std::priority_queue<Point, std::vector<Point>, decltype(compPoint)> que(compPoint);
int minV = 0;
for (int i = 1; i < N; ++i) {
if (compPoint(sks[i], sks[minV])) {
minV = i;
}
}
que.push(sks[minV]);
isSeen[minV] = true;
while (not que.empty()) {
const auto [r, c] = que.top();
que.pop();
const int f = skMap[{r, c}];
answer.push_back(f);
for (const auto &[ar, ac] : dxy) {
const int nr = r + ar, nc = c + ac;
auto itr = skMap.find({nr, nc});
if (itr == skMap.end()) {
continue;
}
const int t = itr->second;
if (isSeen[t]) {
continue;
}
isSeen[t] = true;
que.push({nr, nc});
}
}
if (answer.size() != N) {
std::cout << "NO" << std::endl;
return 0;
}
std::cout << "YES" << std::endl;
for (const auto e : answer) {
std::cout << e + 1 << std::endl;
}
}