#include using namespace std; #include using namespace atcoder; using mint=modint998244353; //1000000007; using ll=long long; using pp=pair; #define sr string #define vc vector #define db double #define fi first #define se second #define rep(i,n) for(int i=0;i<(int)n;i++) #define pb push_back #define all(v) v.begin(),v.end() #define pque priority_queue #define bpc(a) __builtin_popcount(a) int main(){ int n;cin>>n; vc>v; rep(i,n){ int a,b,c;cin>>a>>b>>c; v.pb({a,{c,1}}); v.pb({b,{c,-1}}); } int q;cin>>q; vcans(q); rep(i,q){ int a;cin>>a; v.pb({a,{i,0}}); } sort(all(v)); sets; rep(i,q+1)s.insert(i); vcc(q+1,0); for(auto [z,x]:v){ auto [a,t]=x; if(a>q)continue; if(t==0)ans[a]=*s.begin(); if(t==1){ if(c[a]==0)s.erase(a); c[a]++; } if(t==-1){ if(c[a]==1)s.insert(a); c[a]--; } } rep(i,q)cout<