#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
using namespace std;
using namespace __gnu_pbds;
typedef tree<
pair<int, int>,
null_type,
less<pair<int, int>>,
rb_tree_tag,
tree_order_statistics_node_update> ordered_set;
int main()
{
//freopen("input.txt", "r", stdin);
//freopen("output.txt", "w", stdout);
ios::sync_with_stdio(0);
cin.tie(0);
int n, m, l;
cin >> n >> m >> l;
pair<int, int> sq[n];
for(auto &it: sq)
cin >> it.first >> it.second;
sort(sq, sq + n);
pair<int, int> po[m];
for(auto &it: po)
cin >> it.first >> it.second;
set<int> fst;
for(int i = 0; i < n; i++)
fst.insert(sq[i].first);
for(int i = 0; i < m; i++)
fst.insert(po[i].first);
sort(po, po + m);
int ans = 0;
int i = 0, j = 0, k = 0;
ordered_set me;
for(auto it: fst)
{
while(i < n && sq[i].first == it)
me.insert({sq[i].second, i}), i++;
while(sq[k].first + l < it)
me.erase({sq[k].second, k}), k++;
while(j < m && po[j].first == it)
ans = max(ans, (int)me.order_of_key({po[j].second + 1, 0}) - (int)me.order_of_key({po[j].second - l, 0})), j++;
}
cout << ans << "\n";
}
I2luY2x1ZGUgPGJpdHMvc3RkYysrLmg+CiNpbmNsdWRlIDxleHQvcGJfZHMvYXNzb2NfY29udGFpbmVyLmhwcD4KCnVzaW5nIG5hbWVzcGFjZSBzdGQ7CnVzaW5nIG5hbWVzcGFjZSBfX2dudV9wYmRzOwoKdHlwZWRlZiB0cmVlPApwYWlyPGludCwgaW50PiwKbnVsbF90eXBlLApsZXNzPHBhaXI8aW50LCBpbnQ+PiwKcmJfdHJlZV90YWcsCnRyZWVfb3JkZXJfc3RhdGlzdGljc19ub2RlX3VwZGF0ZT4gb3JkZXJlZF9zZXQ7CgppbnQgbWFpbigpCnsKICAgIC8vZnJlb3BlbigiaW5wdXQudHh0IiwgInIiLCBzdGRpbik7CiAgICAvL2ZyZW9wZW4oIm91dHB1dC50eHQiLCAidyIsIHN0ZG91dCk7CiAgICBpb3M6OnN5bmNfd2l0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