#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(n);++i)
#define all(a) (a).begin(),(a).end()
using namespace std;
typedef long long ll;

int main() {
	ios::sync_with_stdio(false);
	cin.tie(0);
	int n;
	cin >> n;
	vector<int> X(n); vector<int> Y(n);
	vector<int> res(n);
	rep(i, n) {
		cin >> X[i];
	}
	rep(i, n) {
		cin >> Y[i];
		res[i] = X[i] + Y[i];
	}
	vector<int> anstapi(n + 2);
	sort(all(res));
	anstapi[0] = 0;
	for (int i = 1; i < n + 1; ++i) {
		if (abs(res[0] - X[i - 1]) >= abs(res[0] - Y[i - 1])) {
			anstapi[i] = Y[i - 1];
		}
		else {
			anstapi[i] = X[i - 1];
		}
	}
	anstapi[n + 1] = res[0];
	cout << anstapi[n + 1] << endl;
	rep(i, n + 2) {
		cout << anstapi[i] << endl;
	}
	return 0;
}