#include<bits/stdc++.h>
using namespace std;
typedef long long int ll;
#define endl '\n'
int main (){
    ios_base::sync_with_stdio(false);
    cin.tie(0);

    ll n;cin>>n;
    vector<ll>a(n),b(n);

    for(int i=0;i<n;i++) cin>>a[i];
    for(int i=0;i<n;i++) cin>>b[i];

//    for(int i=n-1;i>=0;i--){
//        suff_b[i]=max(suff_b[i+1],b[i]);
//    }
    ll mx_a = 1, mx_b = 1,pr=1;
    for(int i=0;i<n;i++){
        mx_a=max(mx_a,a[i]);
        cout<<max(pr,mx_a*b[i])<<endl;
        pr = max(pr,mx_a*b[i]);
    }
    return 0;
}

#include <iostream>
#include <algorithm>
#include <string>
#include <complex>
#include <vector>
#include <set>
#include <cmath>
#include <queue>
#include <map>
#include <stack>
#include <bitset>
#include <numeric> //lcm
#include <iomanip> //double精度 setprecision

#include <chrono>
#include <random>
#include <cassert>

//#include <atcoder/all>

using namespace std;
//using namespace atcoder;

#define rep(i,n) for(int i = 0; i < (n); ++i)
#define rrep(i,n) for(int i = (n)-1; i >= 0; --i)
#define rep1(i,n) for(int i = 1; i <= (n); ++i)
#define rrep1(i,n) for(int i = (n); i >= 1; --i)
#define REP(i,n,m) for(int i = (n); i < (m); ++i)
#define all(vec) (vec).begin(),(vec).end()

#define debug(a) { cerr << #a << " = " << a << endl;}
#define debugV(vec) { cerr << #vec << " : "; for(auto v : vec) cerr << v << " "; cerr << endl; }
#define debug2D(vec2D, w) { cerr << #vec2D << endl;  for(auto vec : vec2D) { for (auto v : vec) cerr << setw(w) << v << " "; cerr << endl; } } 
#define debugVP(vec) { cerr << #vec << " : ";  for(auto v : vec) cerr << "(" << v.first << "," << v.second << ") "; cerr << endl;}
#define debug2DP(vec2D) { cerr << #vec2D << endl;  for(auto vec : vec2D) { for (auto v : vec) cerr << "(" << v.first << "," << v.second << ") "; cerr << endl; } }

typedef long long ll;

constexpr ll INF = 1e14; //32 ~2*10^10 //64 ~9*10^19
//constexpr ll MOD = 998244353;
constexpr ll MOD = 1000000007;
const double EPS = round(1e-6);
const char en = '\n';

/*
struct Edge {
	Edge(int _s, int _t, ll _cost = 1) : from(_s), to(_t), cost(_cost) {};
	int from, to;
	ll cost;
	//ll fee;
};
*/
//typedef ll Edge;7
struct Edge {
	int id;
	int from, to;

	Edge() { id = from = to = -1; };
	Edge(int a, int b, int c) : id(a), from(b), to(c) {};
};
typedef vector<vector<Edge>> Graph;
/*
void add_edge(Graph& g, int from, int to, ll cost = 1) {
	g[from].push_back(Edge(from, to, cost));
}
*/
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } else return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } else return false; }

void solve() {
	ll n; cin >> n;
	vector<ll> a(n), b(n);
	vector<ll> ma(n), mb(n);

	rep(i, n) cin >> a[i];
	rep(i, n) cin >> b[i];
	rep(i, n) { ma[i] = a[i]; if (i-1 >= 0) chmax(ma[i], ma[i-1]);}


	ll ans = 0;

	rep(i, n) {
		chmax(ans,a[i]*b[i]);
		if (i - 1 >= 0) chmax(ans,ma[i-1LL]*b[i]);

		cout << ans << endl;
	}

}

int main() {
	ios::sync_with_stdio(false);
	cin.tie(nullptr);
	cout.tie(nullptr);

	//rep(i,3)
	solve();

}