#include <bits/stdc++.h>
using namespace std;
#ifndef lisie_bimbi
#define endl '\n'
#pragma GCC optimize("O3")
#pragma GCC target("avx,avx2,bmi2,fma")
#endif
using ll = long long;
const ll inf = 1'000'000'000;
void solve(){
int n;
cin >> n;
vector<pair<int, int>> a(n + 1);
vector<int> b(n);
for(int i = 0; i <= n; i++){
cin >> a[i].first;
a[i].second = i;
}
sort(a.begin(), a.end());
for(int i = 0; i < n; i++){
cin >> b[i];
}
sort(b.begin(), b.end());
vector<int> c(n), d(n);
for(int i = 0; i < n; i++){
c[i] = max((int)0, a[i].first - b[i]);
d[i] = max((int)0, a[i + 1].first - b[i]);
}
for(int i = 1; i < n; i++){
c[i] = max(c[i], c[i - 1]);
}
for(int i = n - 2; i >= 0; i--){
d[i] = max(d[i], d[i + 1]);
}
vector<int> answer(n + 1);
for(int i = 0; i <= n; i++){
int ans = 0;
if(i > 0){
ans = max(ans, c[i - 1]);
}
ans = max(ans, d[i]);
answer[a[i].second] = ans;
}
for(auto i : answer){
cout << i << ' ';
}
cout << endl;
}
signed main(){
#ifdef lisie_bimbi
freopen("input.txt", "r", stdin);
freopen("output.txt", "w", stdout);
#else
#endif
cin.tie(nullptr)->sync_with_stdio(false);
int t = 1;
//cin >> t;
while(t--){
solve();
}
}