//NiceDuck
#include "bits/stdc++.h"
typedef long long ll;
using namespace std;
#define FILE "000"
#define foru(i,a,b) for(int i=(int)(a); i<=(int)(b); ++i)
#define ford(i,a,b) for(int i=(int)(a); i>=(int)(b); --i)
#define fastio ios_base::sync_with_stdio(0);cin.tie(0);
#define pb push_back
#define fi first
#define se second
#define el "\n"
#define MASK(i) (1LL<<(i))
#define BIT(i,j) (((i)>>(j))&1)
#define TIME 1.0*clock()/CLOCKS_PER_SEC

const ll MAX=2e3+3,MOD=1e9+7;
int n;
struct Point
{
    int x,y;
    bool operator <(const Point &other) const
    {
        if(x!=other.x) return x>other.x;
        return y>other.y;
    }
} p[MAX];
vector<int> v;
int getVal(int val)
{
    return lower_bound(v.begin(),v.end(),val)-v.begin()+1;
}
void pre()
{
    sort(v.begin(),v.end()); v.erase(unique(v.begin(),v.end()),v.end());
    foru(i,1,n)
    {
        p[i].x=getVal(p[i].x);
        p[i].y=getVal(p[i].y);
    }
    sort(p+1,p+n+1);
//    foru(i,1,n) cout<<p[i].x<<' '<<p[i].y<<el;
}
ll fw[2*MAX][MAX];
void update(int pos, int pos1, ll val)
{
    int j=pos1;
    for(int i=pos; i<2*MAX; i+=i&(-i))
    {
//        for(int j=pos1; j<2*MAX; j+=j&(-j))
//        {
            fw[i][j]=(fw[i][j]+val)%MOD;
//        }
    }
}
ll query(int pos, int pos1)
{
    ll ans=0;
    int j=pos1;
    for(int i=pos; i>0; i-=i&(-i))
    {
//        for(int j=pos1; j>0; j-=j&(-j))
//        {
            ans=(ans+fw[i][j])%MOD;
//        }
    }
    return ans;
}

void calc()
{
    int mx=0;
    foru(i,1,n)
    {
        mx=max(mx,p[i].y);
        update(p[i].y,1,1);
        foru(l,2,n)
        {
            ll q=query(p[i].y-1,l-1);
//            cout<<i<<' '<<l<<' '<<q<<el;
            update(p[i].y,l,q);
        }
//        cout<<el;
    }
    foru(l,1,n)
    {
        cout<<query(mx,l)<<' ';
    }
}

int main()
{
    fastio
    if(fopen(FILE ".inp","r"))
    {
        freopen(FILE ".inp","r",stdin);
        freopen(FILE ".out","w",stdout);
    }
    cin>>n;
    foru(i,1,n) cin>>p[i].x;
    foru(i,1,n)
    {
        cin>>p[i].y;
        v.pb(p[i].x);
        v.pb(p[i].y);
    }
    pre();
    calc();

    return 0;
}
