#include<iostream>
#include<vector>
#include<set>
#include<queue>
#include<algorithm>
using namespace std;
int main(){
int n,q,k;
cin >> n >> k >> q;
vector<int> x(n);
vector<int> t(n);
vector<int> a(n);
vector<int> b(n);
vector<pair<int,pair<int,pair<int,int> > > > events;
// Store of type t[i] opens at location x
// Store of type t[i] closes at location x
// We want to know the quality of living at location y
// (time, query type (openings come before queries, come before closings), location, type/query index)
for (int i=0;i<n;i++){
cin >> x[i] >> t[i] >> a[i] >> b[i];
events.push_back(make_pair(a[i], make_pair(-1, make_pair(x[i], t[i] - 1))));
events.push_back(make_pair(b[i], make_pair( 1, make_pair(x[i], t[i] - 1))));
}
vector<int> answer(q, -1);
for (int i=0;i<q;i++){
int l,y;
cin >> l >> y;
events.push_back(make_pair(y, make_pair(0, make_pair(l, i))));
}
sort(events.begin(), events.end());
//cout << events.size() << endl;
vector<multiset<int> > store(k);
//cout << store.size() << endl;
for (int i=0;i<events.size();i++){
int event_type = events[i].second.first;
//cout << event_type << endl;
if (event_type == -1){
int store_type = events[i].second.second.second;
int l = events[i].second.second.first;
store[store_type].insert(l);
}
if (event_type == 1){
int store_type = events[i].second.second.second;
int l = events[i].second.second.first;
auto it = store[store_type].find(l);
store[store_type].erase(it);
}
if (event_type == 0){
int index = events[i].second.second.second;
int l = events[i].second.second.first;
answer[index] = 0;
for (int j=0;j<k;j++){
int nearest = 100000001;
if (store[j].size() != 0){
auto it = store[j].upper_bound(l);
if (it != store[j].end()) nearest = abs(*it - l);
it = store[j].lower_bound(l);
if (it != store[j].begin()){
it--;
}
nearest = min(nearest, abs(l - *it));
}
answer[index] = max(answer[index], nearest);
}
if (answer[index] == 100000001) answer[index] = -1;
}
}
for (int i=0;i<q;i++) cout << answer[i] << endl;
return 0;
}