#include<iostream>
#include<vector>
#include<string>
#include<cstdio>
#include<algorithm>
#include<iomanip>

using namespace std;
typedef long long ll;
typedef unsigned long long ull;

const ll LLMAX = (1llu<<(sizeof(ll)*8-1)) - 1;
const int IMAX = (1llu<<(sizeof(int)*8-1)) - 1;


const ull Nmax = 2 * 100000 + 100;
ull amax[Nmax];
ull bmax[Nmax];

ull N, a[Nmax], b[Nmax], c[Nmax];

int main(){
  cin >> N;
  for(ull i = 0; i < N; i++){
    cin >> a[i];
    if(i == 0){
      amax[i] = a[i];
    } else {
      amax[i] = max(a[i], amax[i-1]);
    }
  }
  for(ull i = 0; i < N; i++){
    cin >> b[i];
    if(i == 0){
      bmax[i] = b[i];
    } else {
      bmax[i] = max(b[i], bmax[i-1]);
    }
  }
  c[0] = a[0] * b[0];
  for(ull i = 1; i < N; i++){
    c[i] = max(c[i-1], b[i] * amax[i]);
  }
  for(ull i = 0; i < N; i++){
    cout << c[i] << endl;
  }
  return 0;
}

#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i,n) for(int i=0;i<(n);i++)
void chmax(ll& a, ll b) {if (b>a) a=b;}

int main() {
  int N;
  cin >> N;
  vector<int> a(N), b(N);
  rep(i,N) cin >> a[i];
  rep(i,N) cin >> b[i];
  ll ans = 0, maxa = 0;
  rep(i,N) {
    chmax(maxa, a[i]);
    chmax(ans, maxa*b[i]);
    cout << ans << endl;
  }
}
