#include<bits/stdc++.h>
using namespace std;
#define ll unsigned long long
#define endl '\n'
void solve(int cs){
int n;cin>>n;
std::vector<pair<int,int>>v;
vector<int>p;
for(int i = 0; i < n; i++){
int a;
cin>>a;
v.push_back({a,1e8});
}
int m;cin>>m;
for(int i = 0; i < m; i++){
int a;
cin>>a;
v.push_back({a,-i});
p.push_back(a);
}
sort(v.rbegin(),v.rend());
for(int i = 0; i < n+m; i++){
if(v[i].second <= 0){
p[abs(v[i].second)] = i+1;
}
}
for(auto u:p)cout<<u<<" ";
}
int main()
{
ios_base::sync_with_stdio(false);cin.tie(0);
int t=1,cs=0;
//cin >> t;
while(t--)
{
solve(++cs);
}
return 0;
}