#include <bits/stdc++.h>
#define ll long long
#define all(x) x.begin(), x.end()
#define in insert
#define F first
#define S second
#define ppf pop_front
#define pb push_back
#define ppb pop_back
#define pf push_front
#define pii pair <ll, ll>
#define pll pair <ll, ll>
#define boost() ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
#define sz(x) (int)x.size()
#define int ll
using namespace std;
const int N = 5e5+123;
const ll mod = 1e9+7;
const int mod2 = 1000001617;
const ll inf = 1e9;
//const int k = 320;
int n,m,q;
int lf[N],rg[N];
int st[N] , en[N];
int mt[N];
void solve() {
    cin >> n >> m >> q;
    for(int i=1 ; i <= m ; i++){
        cin >> lf[i] >> rg[i];
        mt[rg[i]]=1;
    }
    for(int i=1 ; i <= q ; i++){
        cin >> st[i] >> en[i];
        if(mt[en[i]] == 1)
            cout << "YES\n";
        else    
            cout << "NO\n";
    }
}
signed main() {
    boost();
    
    int tt=1;
    //cin >> tt;
    int i=1;
    while (tt--) {
        //cout << "Set " << i << ": " ;
        solve();
        //cout << ".\n";
        i++;
    }
    return 0;
}
| # | Verdict | Execution time | Memory | Grader output | 
|---|
| Fetching results... | 
| # | Verdict | Execution time | Memory | Grader output | 
|---|
| Fetching results... | 
| # | Verdict | Execution time | Memory | Grader output | 
|---|
| Fetching results... | 
| # | Verdict | Execution time | Memory | Grader output | 
|---|
| Fetching results... | 
| # | Verdict | Execution time | Memory | Grader output | 
|---|
| Fetching results... | 
| # | Verdict | Execution time | Memory | Grader output | 
|---|
| Fetching results... |