#include #include #include using namespace atcoder; using mint = modint998244353; using namespace std; #define rep(i,n) for (int i = 0; i < (n); ++i) #define Inf32 1000000001 #define Inf64 1000000000000000001 int main(){ int N,A; cin>>N>>A; set> S; rep(i,N){ int x; cin>>x; S.emplace(x,i); } int T; cin>>T; vector l(T),r(T); rep(i,T)cin>>l[i]>>r[i]; vector ans(N,-1); for(int i=T-1;i>=0;i--){ auto it = S.lower_bound(make_pair(l[i],-1)); while(it!=S.end()){ if(it->first > r[i])break; ans[it->second] = i+1; it = S.erase(it); } } rep(i,N){ cout<