# include <iostream>
# include <algorithm>
#include <array>
# include <cassert>
#include <cctype>
#include <climits>
#include <numeric>
# include <vector>
# include <string>
# include <set>
# include <map>
# include <cmath>
# include <iomanip>
# include <functional>
# include <tuple>
# include <utility>
# include <stack>
# include <queue>
# include <list>
# include <bitset>
# include <complex>
# include <chrono>
# include <random>
# include <limits.h>
# include <unordered_map>
# include <unordered_set>
# include <deque>
# include <cstdio>
# include <cstring>
#include <stdio.h>
#include<time.h>
#include <stdlib.h>
#include <cstdint>
#include <cfenv>
#include<fstream>
//#include <bits/stdc++.h>
using namespace std;
using LL = long long;
using ULL = unsigned long long;
long long MOD = 1000000000 + 7; //924844033 1000000000 + 7;
constexpr long long INF = numeric_limits<LL>::max();
const double PI = acos(-1);
#define fir first
#define sec second
#define thi third
#define debug(x) cerr<<#x<<": "<<x<<'\n'
typedef pair<LL, LL> Pll;
typedef pair<double, double> Dll;
typedef pair<LL, pair<LL, LL>> Ppll;
typedef pair<LL, pair<LL, bitset<100001>>> Pbll;
typedef pair<LL, pair<LL, vector<LL>>> Pvll;
typedef pair<LL, LL> Vec2;
struct Tll { LL first, second, third; };
struct Fll { LL first, second, third, fourth; };
typedef pair<LL, Tll> Ptll;
#define rep(i,rept) for(LL i=0;i<rept;i++)
#define Rrep(i,mf) for(LL i=mf-1;i>=0;i--)
LL h, w, n, m, k, t, s, p, q, last, first, cnt, sum, ans, dp[200000];
Pll a[200000], b[200000];
string str, ss;
bool f;
char c;
int di[4][2] = { { 0,1 },{ 1,0 },{ 0,-1 },{ -1,0 } };
struct Edge { LL to, cost; };
struct edge { LL from, to, cost; };
vector<vector<Edge>>vec;
vector<edge>ed;
vector<LL>v;
map<LL,LL>ma;
set<LL>st;
void YN(bool f) {
	if (f)
		cout << "YES" << endl;
	else
		cout << "NO" << endl;
}
void yn(bool f) {
	if (f)
		cout << "Yes" << endl;
	else
		cout << "No" << endl;
}
vector<LL> dijkstra(vector<vector<Edge>>&g, int s) {
	vector<LL>dist(g.size());
	rep(i, g.size()) {
		dist[i] = INF;
	}
	priority_queue<Pll, vector<Pll>, greater<Pll>> q;
	dist[s] = 0;
	q.emplace(dist[s], s);
	while (!q.empty()) {
		LL cost;
		int idx;
		tie(cost, idx) = q.top();
		q.pop();
		if (dist[idx] < cost) continue;
		for (auto &e : g[idx]) {
			auto next = cost + e.cost;
			if (dist[e.to] <= next) continue;
			dist[e.to] = next;
			q.emplace(dist[e.to], e.to);
		}
	}
	return dist;
}

int main() {
	cin >> n;
	vec.resize(n);
	rep(i, n) {
		cin >> a[i].fir;
		a[i].sec= i;
	}
	rep(i, n) {
		cin >> b[i].fir;
		b[i].sec = i;
	}
	sort(a, a + n);
	sort(b, b + n);
	rep(i, n - 1) {
		vec[a[i].sec].push_back(Edge{ a[i + 1].sec, a[i + 1].fir - a[i].fir });
		vec[a[i+1].sec].push_back(Edge{ a[i].sec, a[i + 1].fir - a[i].fir });
		vec[b[i].sec].push_back(Edge{ b[i + 1].sec, b[i + 1].fir - b[i].fir });
		vec[b[i + 1].sec].push_back(Edge{ b[i ].sec, b[i + 1].fir - b[i].fir });
	}
	vector<LL>d=dijkstra(vec, 0);
	rep(i, n) {
		cout << d[i]<< endl;
	}
	return 0;
}

