#include <bits/stdc++.h>
using namespace std;

int main(){
  long long N;
  cin >> N;
  vector<long long> A(N),B(N);
  for(int i=0;i<N;i++) cin >> A[i];
  for(int i=0;i<N;i++) cin >> B[i];
  
  long long Amax=0;
  priority_queue<long long> Q;
  for(int i=0;i<N;i++){
    Amax = max(Amax,A[i]);
    Q.push(Amax * B[i]);
    cout << Q.top() << endl;
  }
  return 0;
}

//#pragma GCC optimize("Ofast")
//#pragma GCC optimize("O2")
//#pragma GCC optimize("O3")
//#pragma GCC optimize("unroll-loops")
////
//#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx")
#include <bits/stdc++.h>

#include <utility>

#define all(x) (x).begin(), (x).end()
#define allp(x) (x)->begin(), (x)->end()

#define pb push_back


using namespace std;
void dout() { cerr << endl; }
//typedef long long ll;
template <typename Head, typename... Tail>
void dout(Head H, Tail... T) {
    cerr << H << ' ';
    dout(T...);
}

using ll = long long;
//#ifdef __int128
//using hll = __int128;
//#endif
using pii = pair<ll, ll>;
using ld = long double;

template <typename T>
void do_uniq(vector<T> &vec){
    sort(all(vec));
    vec.resize(unique(all(vec)) - vec.begin());
}

#ifndef ONLINE_JUDGE

clock_t timestamp_start = clock();
void time_calc()
{
    cerr << (ld)(clock() - timestamp_start) / CLOCKS_PER_SEC << "\n";
}
#endif


#ifdef _getchar_nolock
#else
#    define _getchar_nolock getchar_unlocked
#endif

#define integer int

integer mod = 1e9 + 7;

integer ml(integer a, integer b) {
    return (a * 1ll * b) % mod;
}

integer add(integer a, integer b) {
    integer rt = a + b;
    if (rt < mod) return rt;
    return rt - mod;
}

integer sub(integer a, integer b) {
    return add(a, mod - b);
}

integer sq(integer a) {
    return ml(a, a);
}

integer b_p(integer b, ll p) {
    if (p == 0) return 1;
    if (p & 1) return ml(b, b_p(b, p - 1));
    return sq(b_p(b, p >> 1));
}

const ll inf = 1e18 + 231;

#define solvsh
//#define multi

#ifdef solvsh

void precalc() {}
const int INF = 2e9;

vector<int> divs[200];

const int MAXN = 52;

ld C[MAXN][MAXN];



void solve() {

    int n;
    cin >> n;
    vector<ll> ai;
    vector<ll> bi;

    for (int i = 0; i < n; ++i) {
        int a;
        cin >> a;
        ai.push_back(a);
    }
    for (int i = 0; i < n; ++i) {
        int b;
        cin >> b;
        bi.push_back(b);
    }

    ll a_mx = ai[0];
    ll c_mx = bi[0] * ai[0];

    for (int i = 0; i < n; ++i) {
        a_mx = max(a_mx, ai[i]);
        c_mx = max(c_mx, bi[i] * a_mx);

        cout << c_mx<< "\n";
    }


}

#else

void precalc() {}

void solve() {}

#endif

void multisolve() {
    precalc();
    int t;

    cin >> t;

    int i = 1;
    while (t--) {
        solve();
        i++;
    }
}

void singlesolve (){
    precalc();
    solve();
}

#ifndef ONLINE_JUDGE

void gen() {
}


#endif

#define int int
int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr), cout.tie(nullptr);
    cout << fixed << setprecision(20);



#ifdef multi
    //            gen();
    multisolve();
#else
    singlesolve();
//    gen();
#endif
//     time_calc();
}