#include using i64 = long long; int main() { std::ios::sync_with_stdio(false); std::cin.tie(nullptr); int n; std::cin >> n; std::vector> events; for (int i = 0; i < n; i++) { int l, r, a; std::cin >> l >> r >> a; l--; events.emplace_back(l, 0, a); events.emplace_back(r, -1, a); } int q; std::cin >> q; std::vector ans(q); for (int i = 0; i < q; i++) { int x; std::cin >> x; x--; events.emplace_back(x, 1, i); } std::vector cnt(n + 1); std::set ex; for (int i = 0; i <= n; i++) { ex.insert(i); } std::sort(events.begin(), events.end()); for (auto [_, t, x] : events) { if (t == -1) { if (x <= n && --cnt[x] == 0) { ex.insert(x); } } else if (t == 0) { if (x <= n && cnt[x]++ == 0) { ex.erase(x); } } else { ans[x] = *ex.begin(); } } for (int i = 0; i < q; i++) { std::cout << ans[i] << "\n"; } return 0; }