#include <bits/stdc++.h>
using namespace std;
const int maxn = 2e5 + 5;
const int nx[8] = {1, 1, -1, -1, 1, 0, -1, 0};
const int ny[8] = {1, -1, -1, 1, 0, 1, 0, -1};
map<int, map<int,int>>mp;
bool vis[maxn];
vector<pair<int,int>>point;
int n, cnt = 0, t;
vector<int> ans;
bool cmp(pair<int,int> x, pair<int, int> y)
{
return mp[x.first][x.second] > mp[y.first][y.second];
}
int main() {
ios_base::sync_with_stdio(0);
cin.tie(0);
cin >> n >> t;
for(int i = 1; i <= n; i++)
{
int x, y;
cin >> x >> y;
point.push_back({x, y});
mp[x][y] = i;
}
queue<pair<int,int>> q;
q.push(point.back());
vis[n] = 1;
while(q.size())
{
pair<int,int> res = q.front();
q.pop();
int x = res.first, y = res.second;
cnt++;
ans.push_back(mp[x][y]);
vector<pair<int,int>> newpos;
for(int i = 0; i < 8; i++)
{
int dx = x + nx[i], dy = y + ny[i];
int temp = mp[dx][dy];
if(temp && !vis[temp])
{
newpos.push_back({dx, dy});
vis[temp] = 1;
}
}
sort(newpos.begin(), newpos.end(), cmp);
for(pair<int, int> Pair : newpos) q.push(Pair);
}
if(cnt == n)
{
cout << "YES\n";
for(int x : ans) cout << x << '\n';
}
else cout << "NO";
return 0;
}