#include <bits/stdc++.h>
using namespace std;
#define int long long
using vec_int = vector<int>;
using P = pair<int,int>;
using T = tuple<int,int,int>;
using ll = long long;
#define rep(i, n) for(int i = 0; i < (int)(n); i++)

int charToInt(char c){
    char zero_num = '0';
    return (int)c - (int)zero_num;
}

signed main(){
    int N; cin>>N;

    vec_int a(N), b(N);
    rep(i,N)cin>>a.at(i);
    rep(i,N)cin>>b.at(i);

    vec_int max_a(N);
    max_a.at(0) = a.at(0);
    for(int i=1;i<N;i++){
        max_a.at(i) = max(max_a.at(i-1), a.at(i));
    }

    vec_int max_mult(N);
    for(int i=0;i<N;i++){
        max_mult.at(i) = b.at(i) * max_a.at(i);
    }

    int max_val = 0;
    for(int i=0;i<N;i++){
        max_val = max(max_mult.at(i), max_val);
        cout<<max_val<<endl;
    }





    return 0;
}
#include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); ++i)
using namespace std;
using ll = long long;
using P = pair<ll, ll>;

void solve(long long N, std::vector<long long> a, std::vector<long long> b) {
    ll maxA = 0;
    ll maxC = 0;
    rep(i, N) {
        maxC = max(maxC, a[i] * b[i]);
        maxC = max(maxC, maxA * b[i]);
        maxA = max(maxA, a[i]);
        cout << maxC << "\n";
    }
}

// Generated by 1.1.7.1 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
int main() {
    long long N;
    scanf("%lld", &N);
    std::vector<long long> a(N);
    for (int i = 0; i < N; i++) {
        scanf("%lld", &a[i]);
    }
    std::vector<long long> b(N);
    for (int i = 0; i < N; i++) {
        scanf("%lld", &b[i]);
    }
    solve(N, std::move(a), std::move(b));
    return 0;
}
