//Man always remember love because of romance only!
#include<bits/stdc++.h>
using namespace std;
inline int read(){
int n=0,w=0; char ch=0;
while(!isdigit(ch)) {w|=ch=='-';ch=getchar();}
while(isdigit(ch)) n=(n<<3)+(n<<1)+(ch^48),ch=getchar();
return w?-n:n;
}
inline void write(int x){
if(x<0) putchar('-'),x=-x;
if(x>9) write(x/10);
putchar(x%10+'0');
}
int x[200001],y[200001],xx[200001],yy[200001];
int p[200001],q[200001];
bool cmp1(int a,int b){
if(x[a]==x[b]) return yy[a]<yy[b];
return x[a]<x[b];
}
bool cmp2(int a,int b){
if(xx[a]==xx[b]) return yy[a]<yy[b];
return xx[a]<xx[b];
}
int c[200001];
int main(){
int n=read();
for(int i=1;i<=n;i++) x[i]=read(),y[i]=read();
for(int i=1;i<=n;i++) xx[i]=read(),yy[i]=read();
for(int i=1;i<=n;i++) q[i]=i,p[i]=i;
sort(q+1,q+n+1,cmp2);
sort(p+1,p+n+1,cmp1);
int j=1;
set<array<int,3>> s;
for(int i=1;i<=n;i++){
while(j<=n&&x[p[j]]<xx[q[i]]){
s.insert({y[p[j]],x[p[j]],p[j]});
j++;
}
auto it=s.lower_bound({yy[q[i]],-1000000000,1});
if(it==s.begin()){
puts("No");
return 0;
}
it--;
s.erase(it);
c[(*it)[2]]=q[i];
}
vector<array<int,4>> a;
for(int i=1;i<=n;i++){
int j=c[i];
a.push_back({x[i],2,y[i]});
a.push_back({xx[j],0,yy[j]});
a.push_back({x[i],2,yy[j]});
a.push_back({xx[j],0,y[i]});
a.push_back({x[i],1,y[i],yy[j]});
a.push_back({xx[j],1,y[i],yy[j]});
}
sort(a.begin(),a.end());
multiset<int> S;
for(auto [x,op,y1,y2]:a){
if(op==0) S.extract(y1);
else if(op==2) S.insert(y1);
else{
auto it=S.upper_bound(y1);
if(it!=S.end()&&(*it)<y2){
puts("No");
return 0;
}
}
}
puts("Yes");
for(int i=1;i<=n;i++) write(c[i]),putchar('\n');
return 0;
}