#include using namespace std; #define rep(i, n) for (int i=0; i> N; vector> event; rep(i, N) { int l, r, a; cin >> l >> r >> a; event.pb({l, 0, a}); event.pb({r+1, 1, a}); } int Q; cin >> Q; rep(i, Q) { int x; cin >> x; event.pb({x, 2, i}); } sort(event.begin(), event.end()); int ans[Q]; set s; rep(i, N+1) s.insert(i); map mp; rep(i, event.size()) { if (event[i][1]==0) { mp[event[i][2]]++; s.erase(event[i][2]); } else if (event[i][1]==1) { mp[event[i][2]]--; if (mp[event[i][2]]==0) s.insert(event[i][2]); } else ans[event[i][2]] = *s.begin(); } rep(i, Q) cout << ans[i] << endl; }