
// Problem: A - Two Sequences 2
// Contest: AtCoder - KEYENCE Programming Contest 2021
// URL: https://atcoder.jp/contests/keyence2021/tasks/keyence2021_a
// Memory Limit: 1024 MB
// Time Limit: 2000 ms
// Powered by CP Editor (https://github.com/cpeditor/cpeditor)

#include <bits/stdc++.h>
#define fi first
#define se second
#define pb push_back
#define int long long
#define F(i, n) for (int i = 0; i < n; i++)
#define all(x)(x).begin(), (x).end()
#define show(A) for (auto i: A) cout << i << " "; cout << '\n';
#define show_(A, n) F(i, n) { show(A[i]) }

using namespace std;
using ld = long double;
using vi = vector < int > ;
using mi = map < int, int > ;
using pi = pair < int, int > ;

const int N = 100005;
const int MOD = 1e9 + 7;
const int inf = 1e18 + 1;
/***************************code begins here*****************************/

void solve() {
    int n, ans = 0;
    cin >> n;
    vi a(n);
    F(i, n) cin >> a[i];

    show(a);
    cout << ans << '\n';
}
int32_t main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    int n; cin>>n;
    vi x(n),y(n);
    F(i,n) cin>>x[i];
    F(i,n) cin>>y[i];
    set<int> a,b; int ans=-1;
    for(int i=0;i<n;i++){
    	a.insert(-x[i]);
    	ans = max(ans ,(-y[i]) * (*a.begin()) );
    	cout<< ans  <<'\n' ;
    }

    return 0;
}
#include <bits/stdc++.h>
#include <vector>
#include <iostream>
#include<algorithm>
#include<string>
#include <map>
#include <queue>
#include <stack>
#include<set>

//#define DIV 1000000007
#define TE 2e5
using namespace std;
using ll = long long;
using ldb = long double;

int main() {
    int 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];
    }

    ll ma = a[0], mb = b[0];
    vector<ll> c(N);
    c[0] = a[0] * b[0];
    for (int i = 1; i < N; i++) {
        ma = max(ma, a[i]);
        //c[i] = max(c[i - 1], max(ma * b[i], mb * a[i]));
        c[i] = max(c[i - 1], ma * b[i]);
        mb = max(mb, b[i]);
    }

    for (int i = 0; i < N; i++) {
        cout << c[i] << endl;
    }
   
}
