#include using namespace std; #ifdef LOCAL #include #define OUT(...) debug_print::multi_print(#__VA_ARGS__, __VA_ARGS__) #else #define OUT(...) (static_cast(0)) #endif int main(){ int N, M; cin >> N >> M; assert(1 <= N && N <= 1e5); assert(1 <= M && M <= 1000); using ll = int; vector> p(N), q(M); for(int i = 0; i < N; i++){ cin >> p[i].first >> p[i].second; assert(-1e9 <= p[i].first && p[i].first <= p[i].second && p[i].second <= 1e9); p[i].first *= 2; p[i].second *= 2; } for(int i = 0; i < M; i++){ cin >> q[i].first >> q[i].second; assert(-1e9 <= q[i].first && q[i].first <= q[i].second && q[i].second <= 1e9); q[i].first *= 2; q[i].second *= 2; } int K; cin >> K; assert(1 <= K && K <= 1000); vector P(K); for(int i = 0; i < K; i++){ cin >> P[i]; assert(-1e9 <= P[i] && P[i] <= 1e9); P[i] *= 2; } for(int i = 0; i < K - 1; i++){ assert(P[i] < P[i + 1]); } bool all = false; sort(p.begin(), p.end()); for(int i = 0; i < N - 1; i++){ if(p[i].second >= p[i + 1].first){ all = true; } } sort(q.begin(), q.end()); for(int i = 0; i < M - 1; i++){ if(q[i].second >= q[i + 1].first){ all = true; } } vector ans(K, all); for(int i = 0; i < N; i++){ int idx = 0; for(int j = 0; j < M; j++){ ll mid = (p[i].second + q[j].first) / 2; ll l = mid - (p[i].second - p[i].first) / 2; ll r = mid + (q[j].second - q[j].first) / 2; while(idx < K && P[idx] <= r){ if(P[idx] >= l){ ans[idx] = true; } idx++; } } } for(int i = 0; i < K; i++){ cout << ans[i] << (i == K - 1 ? '\n' : ' '); } }