#include<bits/stdc++.h>
typedef long long int ll;
typedef unsigned long long int ull;
#define BIG_NUM 2000000000
#define HUGE_NUM 99999999999999999
#define MOD 1000000007
#define EPS 0.000000001
using namespace std;


#define NUM 100005

enum Which{
	A,
	B,
};

struct Info{
	Info(int arg_value,int arg_index){
		value = arg_value;
		index = arg_index;
	}
	bool operator<(const struct Info &arg) const{

		return value < arg.value;
	}
	int value,index;
};

struct State{

	State(Which arg_which,int arg_index,int arg_min_dist){
		which = arg_which;
		index = arg_index;
		min_dist = arg_min_dist;
	}
	bool operator<(const struct State &arg) const{

		return min_dist > arg.min_dist; //最短距離の昇順(PQ)
	}

	Which which;
	int index,min_dist;

};

int N;
int LOC[2][NUM];
int table[2][NUM],final[NUM];
vector<Info> info[2];
Which rev[2] = {B,A};


int main(){

	scanf("%d",&N);

	int tmp;

	for(int loop = 0; loop < N; loop++){

		scanf("%d",&tmp);
		info[A].push_back(Info(tmp,loop));
	}

	for(int loop = 0; loop < N; loop++){

		scanf("%d",&tmp);
		info[B].push_back(Info(tmp,loop));
	}

	sort(info[A].begin(),info[A].end());
	sort(info[B].begin(),info[B].end());

	//dataがどこにおかれているかを記録
	for(int i = 0; i < N; i++){

		LOC[A][info[A][i].index] = i;
		LOC[B][info[B][i].index] = i;
	}

	table[A][0] = 0;
	table[B][0] = 0;
	final[0] = 0;

	for(int i = 1; i < N; i++){

		table[A][i] = BIG_NUM;
		table[B][i] = BIG_NUM;
		final[i] = BIG_NUM;
	}

	priority_queue<State> Q;

	//始点に隣接するノードをQにpush
	for(int i = 0; i < N; i++){

		if(info[A][i].index == 0){

			if(i > 0){

				table[A][info[A][i-1].index] = abs(info[A][i].value-info[A][i-1].value);
				Q.push(State(A,info[A][i-1].index,abs(info[A][i].value-info[A][i-1].value)));
			}
			if(i < N-1){

				table[A][info[A][i+1].index] = abs(info[A][i].value-info[A][i+1].value);
				Q.push(State(A,info[A][i+1].index,abs(info[A][i].value-info[A][i+1].value)));
			}
			break;
		}
	}

	for(int i = 0; i < N; i++){

		if(info[B][i].index == 0){

			if(i > 0){

				table[B][info[B][i-1].index] = abs(info[B][i].value-info[B][i-1].value);
				Q.push(State(B,info[B][i-1].index,abs(info[B][i].value-info[B][i-1].value)));
			}
			if(i < N-1){

				table[B][info[B][i+1].index] = abs(info[B][i].value-info[B][i+1].value);
				Q.push(State(B,info[B][i+1].index,abs(info[B][i].value-info[B][i+1].value)));
			}
			break;
		}
	}

	int left_next,right_next,left_index,right_index;

	while(!Q.empty()){

		if(Q.top().min_dist > table[Q.top().which][Q.top().index]){

			Q.pop();

		}else{

			final[Q.top().index] = min(final[Q.top().index],table[Q.top().which][Q.top().index]); //最終最小値を更新

			//左右のノードを見る
			if(LOC[Q.top().which][Q.top().index] > 0){

				left_next = final[Q.top().index]+abs(info[Q.top().which][LOC[Q.top().which][Q.top().index]].value
						-info[Q.top().which][LOC[Q.top().which][Q.top().index]-1].value);
				left_index = info[Q.top().which][LOC[Q.top().which][Q.top().index]-1].index;

				if(table[Q.top().which][left_index] > left_next){

					table[Q.top().which][left_index] = left_next;
					Q.push(State(Q.top().which,left_index,left_next));
				}
			}
			if(LOC[rev[Q.top().which]][Q.top().index] > 0){ //★★もう一方の経路も見る

				left_next = final[Q.top().index]+abs(info[rev[Q.top().which]][LOC[rev[Q.top().which]][Q.top().index]].value
						-info[rev[Q.top().which]][LOC[rev[Q.top().which]][Q.top().index]-1].value);
				left_index = info[rev[Q.top().which]][LOC[rev[Q.top().which]][Q.top().index]-1].index;

				if(table[rev[Q.top().which]][left_index] > left_next){

					table[rev[Q.top().which]][left_index] = left_next;
					Q.push(State(rev[Q.top().which],left_index,left_next));
				}
			}


			if(LOC[Q.top().which][Q.top().index] < N-1){

				right_next = final[Q.top().index]+abs(info[Q.top().which][LOC[Q.top().which][Q.top().index]].value
						-info[Q.top().which][LOC[Q.top().which][Q.top().index]+1].value);
				right_index = info[Q.top().which][LOC[Q.top().which][Q.top().index]+1].index;

				if(table[Q.top().which][right_index] > right_next){

					table[Q.top().which][right_index] = right_next;
					Q.push(State(Q.top().which,right_index,right_next));
				}
			}

			if(LOC[rev[Q.top().which]][Q.top().index] < N-1){ //★★もう一方の経路も見る

				right_next = final[Q.top().index]+abs(info[rev[Q.top().which]][LOC[rev[Q.top().which]][Q.top().index]].value
						-info[rev[Q.top().which]][LOC[rev[Q.top().which]][Q.top().index]+1].value);
				right_index = info[rev[Q.top().which]][LOC[rev[Q.top().which]][Q.top().index]+1].index;

				if(table[rev[Q.top().which]][right_index] > right_next){

					table[rev[Q.top().which]][right_index] = right_next;
					Q.push(State(rev[Q.top().which],right_index,right_next));
				}
			}

			Q.pop();
		}
	}

	for(int i = 0; i < N; i++){

		printf("%d\n",final[i]);
	}

	return 0;
}



Measured memory_bytes: 8612