#include using namespace std; void fast_io() { ios_base::sync_with_stdio(false); cin.tie(nullptr); } int main() { fast_io(); int n; cin >> n; vector> s(n); for (int i = 0; i < n; i++) { int x, y; cin >> x >> y; s[i] = {x + y, x - y}; } int m; cin >> m; vector> t(m); for (int i = 0; i < m; i++) { int x, y; cin >> x >> y; t[i] = {x + y, x - y}; } sort(t.begin(), t.end()); int ng = -1, ok = 1e6; while (ng + 1 < ok) { int mid = (ng + ok) / 2; multiset st; bool is_ok = false; int l = 0, r = 0; for (auto [u, v] : s) { while (r < m && t[r].first <= u + mid) { st.insert(t[r].second); r++; } while (l < r && t[l].first < u - mid) { st.erase(st.find(t[l].second)); l++; } cout << l << " " << r << endl; auto it = st.lower_bound(u); if (it != st.end() && *it <= u + mid) { is_ok = true; break; } if (it != st.begin() && *prev(it) >= u - mid) { is_ok = true; break; } } if (is_ok) { ok = mid; } else { ng = mid; } } cout << ok << endl; }