#include <bits/stdc++.h>
#define pb push_back
#define fir first
#define sec second
#define int long long
using namespace std;
signed main(){
int n; cin>>n;
int b[n+1];
pair<int, int> a[n+2];
for(int i=1; i<=n+1; i++){
cin>>a[i].fir;
a[i].sec=i;
}
for(int i=1; i<=n; i++) cin>>b[i];
sort(a+1, a+n+2);
sort(b+1, b+n+1);
int cev[n+2]={0};
vector<int> cur(n+1);
multiset<int> ms;
//k=1
for(int i=1; i<=n; i++){
cur[i]=a[i+1].fir;
ms.insert(max(0LL, cur[i]-b[i]));
}
auto it=ms.end();
it--;
cev[a[1].sec]=(*it);
for(int i=1; i<=n; i++){
ms.erase(ms.find(max(0LL, cur[i]-b[i])));
cur[i]=a[i].fir;
ms.insert(max(0LL, cur[i]-b[i]));
it=ms.end();
it--;
cev[a[i+1].sec]=(*it);
}
for(int i=1; i<=n+1; i++) cout<<cev[i]<<" ";
return 0;
}