/*
 * Author:  heyuhhh
 * Created Time:  2020/3/1 22:51:58
 */
#include <iostream>
#include <algorithm>
#include <cstring>
#include <vector>
#include <cmath>
#include <set>
#include <map>
#include <queue>
#include <iomanip>
#define MP make_pair
#define fi first
#define se second
#define sz(x) (int)(x).size()
#define all(x) (x).begin(), (x).end()
#define INF 0x3f3f3f3f
#define Local
#ifdef Local
  #define dbg(args...) do { cout << #args << " -> "; err(args); } while (0)
  void err() { std::cout << '\n'; }
  template<typename T, typename...Args>
  void err(T a, Args...args) { std::cout << a << ' '; err(args...); }
#else
  #define dbg(...)
#endif
void pt() {std::cout << '\n'; }
template<typename T, typename...Args>
void pt(T a, Args...args) {std::cout << a << ' '; pt(args...); }
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
//head
const int N = 1e6 + 5;

int n, m, p;
pii a[N], b[N];
ll mina[N], minb[N];

struct monster {
    int x, y, z;
    bool operator < (const monster &A) const {
        return x < A.x;
    }
}c[N];

ll maxv[N << 2], lz[N << 2];
ll d[N];

void push_up(int o) {
    maxv[o] = max(maxv[o << 1], maxv[o << 1|1]);
}

void tag(int o, int l, int r, ll v) {
    maxv[o] += v;
    lz[o] += v;
}

void push_down(int o, int l, int r) {
    if(lz[o]) {
        int mid = (l + r) >> 1;
        tag(o << 1, l, mid, lz[o]);
        tag(o << 1|1, mid + 1, r, lz[o]);
        lz[o] = 0;
    }
}

void build(int o, int l, int r) {
    if(l == r) {
        maxv[o] = -d[l];
        return;
    }
    int mid = (l + r) >> 1;
    build(o << 1, l, mid), build(o << 1|1, mid + 1, r);
    push_up(o);
}

void update(int o, int l, int r, int L, int R, ll v) {
    if(L <= l && r <= R) {
        tag(o, l, r, v);
        return;
    }
    push_down(o, l, r);
    int mid = (l + r) >> 1;
    if(L <= mid) update(o << 1, l, mid, L, R, v);
    if(R > mid) update(o << 1|1, mid + 1, r, L, R, v);
    push_up(o);
}

ll query(int o, int l, int r, int L, int R) {
    if(L <= l && r <= R) {
        return maxv[o];
    }
    push_down(o, l, r);
    int mid = (l + r) >> 1;
    ll res = -1e18;
    if(L <= mid) res = query(o << 1, l, mid, L, R);
    if(R > mid) res = max(res, query(o << 1|1, mid + 1, r, L, R));
    return res;
}

void run(){
    for(int i = 1; i <= n; i++) cin >> a[i].fi >> a[i].se;
    for(int i = 1; i <= m; i++) cin >> b[i].fi >> b[i].se;
    sort(a + 1, a + n + 1, [&](pii A, pii B) {
        return A.fi < B.fi;
    });
    sort(b + 1, b + m + 1, [&](pii A, pii B) {
        return A.fi < B.fi;
    });
    vector <int> aa, bb;
    for(int i = 1; i <= n; i++) aa.push_back(a[i].fi);
    for(int i = 1; i <= m; i++) bb.push_back(b[i].fi);
    mina[n + 1] = minb[m + 1] = INF;
    for(int i = n; i >= 1; i--) mina[i] = min(mina[i + 1], (ll)a[i].se);
    for(int i = m; i >= 1; i--) minb[i] = min(minb[i + 1], (ll)b[i].se);
    for(int i = 1; i <= p; i++) {
        cin >> c[i].x >> c[i].y >> c[i].z;
    }
    sort(c + 1, c + p + 1);
    memset(d, INF, sizeof(d));
    for(int i = 1; i <= m; i++) {
        d[b[i].fi] = min(d[b[i].fi], (ll)b[i].se);
    }
    build(1, 1, 1e6);
    ll ans = -mina[1] - minb[1];
    for(int i = 1; i <= p; i++) {
        update(1, 1, 1e6, c[i].y + 1, 1e6, c[i].z);
        ll t = query(1, 1, 1e6, c[i].y + 1, 1e6);
        int tt = upper_bound(all(aa), c[i].x) - aa.begin() + 1;
        ans = max(ans, t - mina[tt]);
    }
    cout << ans << '\n';
}

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0); cout.tie(0);
    cout << fixed << setprecision(20);
    while(cin >> n >> m >> p) run();
    return 0;
}


/*
 * Author:  heyuhhh
 * Created Time:  2020/3/1 22:51:58
 */
#include <iostream>
#include <algorithm>
#include <cstring>
#include <vector>
#include <cmath>
#include <set>
#include <map>
#include <queue>
#include <iomanip>
#define MP make_pair
#define fi first
#define se second
#define sz(x) (int)(x).size()
#define all(x) (x).begin(), (x).end()
#define INF 0x3f3f3f3f
#define Local
#ifdef Local
  #define dbg(args...) do { cout << #args << " -> "; err(args); } while (0)
  void err() { std::cout << '\n'; }
  template<typename T, typename...Args>
  void err(T a, Args...args) { std::cout << a << ' '; err(args...); }
#else
  #define dbg(...)
#endif
void pt() {std::cout << '\n'; }
template<typename T, typename...Args>
void pt(T a, Args...args) {std::cout << a << ' '; pt(args...); }
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
//head
const int N = 1e6 + 5;

int n, m, p;
pii a[N], b[N];
int mina[N], minb[N];

struct monster {
    int x, y, z;
    bool operator < (const monster &A) const {
        return x < A.x;
    }
}c[N];

ll maxv[N << 2], lz[N << 2];
int d[N];

void push_up(int o) {
    maxv[o] = max(maxv[o << 1], maxv[o << 1|1]);
}

void tag(int o, int l, int r, ll v) {
    maxv[o] += v;
    lz[o] += v;
}

void push_down(int o, int l, int r) {
    if(lz[o]) {
        int mid = (l + r) >> 1;
        tag(o << 1, l, mid, lz[o]);
        tag(o << 1|1, mid + 1, r, lz[o]);
        lz[o] = 0;
    }
}

void build(int o, int l, int r) {
    if(l == r) {
        maxv[o] = -d[l];
        return;
    }
    int mid = (l + r) >> 1;
    build(o << 1, l, mid), build(o << 1|1, mid + 1, r);
    push_up(o);
}

void update(int o, int l, int r, int L, int R, ll v) {
    if(L <= l && r <= R) {
        tag(o, l, r, v);
        return;
    }
    push_down(o, l, r);
    int mid = (l + r) >> 1;
    if(L <= mid) update(o << 1, l, mid, L, R, v);
    if(R > mid) update(o << 1|1, mid + 1, r, L, R, v);
    push_up(o);
}

ll query(int o, int l, int r, int L, int R) {
    if(L <= l && r <= R) {
        return maxv[o];
    }
    push_down(o, l, r);
    int mid = (l + r) >> 1;
    ll res = -1e18;
    if(L <= mid) res = query(o << 1, l, mid, L, R);
    if(R > mid) res = max(res, query(o << 1|1, mid + 1, r, L, R));
    return res;
}

void run(){
    for(int i = 1; i <= n; i++) cin >> a[i].fi >> a[i].se;
    for(int i = 1; i <= m; i++) cin >> b[i].fi >> b[i].se;
    sort(a + 1, a + n + 1, [&](pii A, pii B) {
        return A.fi < B.fi;
    });
    sort(b + 1, b + m + 1, [&](pii A, pii B) {
        return A.fi < B.fi;
    });
    vector <int> aa, bb;
    for(int i = 1; i <= n; i++) aa.push_back(a[i].fi);
    for(int i = 1; i <= m; i++) bb.push_back(b[i].fi);
    mina[n + 1] = minb[m + 1] = INF;
    for(int i = n; i >= 1; i--) mina[i] = min(mina[i + 1], a[i].se);
    for(int i = m; i >= 1; i--) minb[i] = min(minb[i + 1], b[i].se);
    for(int i = 1; i <= p; i++) {
        cin >> c[i].x >> c[i].y >> c[i].z;
    }
    sort(c + 1, c + p + 1);
    memset(d, INF, sizeof(d));
    for(int i = 1; i <= p; i++) {
        int t = upper_bound(all(bb), c[i].y) - bb.begin() + 1;
        d[c[i].y] = minb[i];
    }
    build(1, 1, 1e6);
    ll ans = -mina[1] - minb[1];
    for(int i = 1; i <= p; i++) {
        update(1, 1, 1e6, c[i].y, 1e6, c[i].z);
        ll t = query(1, 1, 1e6, c[i].y, 1e6);
        int tt = upper_bound(all(aa), c[i].x) - aa.begin() + 1;
        ans = max(ans, t - mina[tt]);
    }
    cout << ans << '\n';
}

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0); cout.tie(0);
    cout << fixed << setprecision(20);
    while(cin >> n >> m >> p) run();
    return 0;
}


/*
 * Author:  heyuhhh
 * Created Time:  2020/3/1 22:51:58
 */
#include <iostream>
#include <algorithm>
#include <cstring>
#include <vector>
#include <cmath>
#include <set>
#include <map>
#include <queue>
#include <iomanip>
#define MP make_pair
#define fi first
#define se second
#define sz(x) (int)(x).size()
#define all(x) (x).begin(), (x).end()
#define INF 0x3f3f3f3f
#define Local
#ifdef Local
  #define dbg(args...) do { cout << #args << " -> "; err(args); } while (0)
  void err() { std::cout << '\n'; }
  template<typename T, typename...Args>
  void err(T a, Args...args) { std::cout << a << ' '; err(args...); }
#else
  #define dbg(...)
#endif
void pt() {std::cout << '\n'; }
template<typename T, typename...Args>
void pt(T a, Args...args) {std::cout << a << ' '; pt(args...); }
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
//head
const int N = 1e6 + 5;

int n, m, p;
pii a[N], b[N];
ll mina[N], minb[N];

struct monster {
    int x, y, z;
    bool operator < (const monster &A) const {
        return x < A.x;
    }
}c[N];

ll maxv[N << 2], lz[N << 2];
ll d[N];

void push_up(int o) {
    maxv[o] = max(maxv[o << 1], maxv[o << 1|1]);
}

void tag(int o, int l, int r, ll v) {
    maxv[o] += v;
    lz[o] += v;
}

void push_down(int o, int l, int r) {
    if(lz[o]) {
        int mid = (l + r) >> 1;
        tag(o << 1, l, mid, lz[o]);
        tag(o << 1|1, mid + 1, r, lz[o]);
        lz[o] = 0;
    }
}

void build(int o, int l, int r) {
    if(l == r) {
        maxv[o] = -d[l];
        return;
    }
    int mid = (l + r) >> 1;
    build(o << 1, l, mid), build(o << 1|1, mid + 1, r);
    push_up(o);
}

void update(int o, int l, int r, int L, int R, ll v) {
    if(L <= l && r <= R) {
        tag(o, l, r, v);
        return;
    }
    push_down(o, l, r);
    int mid = (l + r) >> 1;
    if(L <= mid) update(o << 1, l, mid, L, R, v);
    if(R > mid) update(o << 1|1, mid + 1, r, L, R, v);
    push_up(o);
}

ll query(int o, int l, int r, int L, int R) {
    if(L <= l && r <= R) {
        return maxv[o];
    }
    push_down(o, l, r);
    int mid = (l + r) >> 1;
    ll res = -1e18;
    if(L <= mid) res = query(o << 1, l, mid, L, R);
    if(R > mid) res = max(res, query(o << 1|1, mid + 1, r, L, R));
    return res;
}

void run(){
    for(int i = 1; i <= n; i++) cin >> a[i].fi >> a[i].se;
    for(int i = 1; i <= m; i++) cin >> b[i].fi >> b[i].se;
    sort(a + 1, a + n + 1, [&](pii A, pii B) {
        return A.fi < B.fi;
    });
    sort(b + 1, b + m + 1, [&](pii A, pii B) {
        return A.fi < B.fi;
    });
    vector <int> aa;
    for(int i = 1; i <= n; i++) aa.push_back(a[i].fi);
    mina[n + 1] = INF;
    for(int i = n; i >= 1; i--) mina[i] = min(mina[i + 1], (ll)a[i].se);
    for(int i = 1; i <= p; i++) {
        cin >> c[i].x >> c[i].y >> c[i].z;
    }
    sort(c + 1, c + p + 1);
    memset(d, INF, sizeof(d));
    for(int i = 1; i <= m; i++) {
        d[b[i].fi] = min(d[b[i].fi], (ll)b[i].se);
    }
    build(1, 1, N - 1);
    ll ans = -mina[1] - minb[1];
    for(int i = 1; i <= p; i++) {
        update(1, 1, N - 1, c[i].y + 1, N - 1, c[i].z);
        ll t = query(1, 1, N - 1, c[i].y + 1, N - 1);
        int tt = upper_bound(all(aa), c[i].x) - aa.begin() + 1;
        ans = max(ans, t - mina[tt]);
    }
    cout << ans << '\n';
}

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0); cout.tie(0);
    cout << fixed << setprecision(20);
    while(cin >> n >> m >> p) run();
    return 0;
}


/*
 * Author:  heyuhhh
 * Created Time:  2020/3/1 22:51:58
 */
#include <iostream>
#include <algorithm>
#include <cstring>
#include <vector>
#include <cmath>
#include <set>
#include <map>
#include <queue>
#include <iomanip>
#define MP make_pair
#define fi first
#define se second
#define sz(x) (int)(x).size()
#define all(x) (x).begin(), (x).end()
#define INF 0x3f3f3f3f
#define Local
#ifdef Local
  #define dbg(args...) do { cout << #args << " -> "; err(args); } while (0)
  void err() { std::cout << '\n'; }
  template<typename T, typename...Args>
  void err(T a, Args...args) { std::cout << a << ' '; err(args...); }
#else
  #define dbg(...)
#endif
void pt() {std::cout << '\n'; }
template<typename T, typename...Args>
void pt(T a, Args...args) {std::cout << a << ' '; pt(args...); }
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
//head
const int N = 1e6 + 5;

int n, m, p;
pii a[N], b[N];
ll mina[N], minb[N];

struct monster {
    int x, y, z;
    bool operator < (const monster &A) const {
        return x < A.x;
    }
}c[N];

ll maxv[N << 2], lz[N << 2];
ll d[N];

void push_up(int o) {
    maxv[o] = max(maxv[o << 1], maxv[o << 1|1]);
}

void tag(int o, int l, int r, ll v) {
    maxv[o] += v;
    lz[o] += v;
}

void push_down(int o, int l, int r) {
    if(lz[o]) {
        int mid = (l + r) >> 1;
        tag(o << 1, l, mid, lz[o]);
        tag(o << 1|1, mid + 1, r, lz[o]);
        lz[o] = 0;
    }
}

void build(int o, int l, int r) {
    if(l == r) {
        maxv[o] = -d[l];
        return;
    }
    int mid = (l + r) >> 1;
    build(o << 1, l, mid), build(o << 1|1, mid + 1, r);
    push_up(o);
}

void update(int o, int l, int r, int L, int R, ll v) {
    if(L <= l && r <= R) {
        tag(o, l, r, v);
        return;
    }
    push_down(o, l, r);
    int mid = (l + r) >> 1;
    if(L <= mid) update(o << 1, l, mid, L, R, v);
    if(R > mid) update(o << 1|1, mid + 1, r, L, R, v);
    push_up(o);
}

ll query(int o, int l, int r, int L, int R) {
    if(L <= l && r <= R) {
        return maxv[o];
    }
    push_down(o, l, r);
    int mid = (l + r) >> 1;
    ll res = -1e18;
    if(L <= mid) res = query(o << 1, l, mid, L, R);
    if(R > mid) res = max(res, query(o << 1|1, mid + 1, r, L, R));
    return res;
}

void run(){
    for(int i = 1; i <= n; i++) cin >> a[i].fi >> a[i].se;
    for(int i = 1; i <= m; i++) cin >> b[i].fi >> b[i].se;
    sort(a + 1, a + n + 1, [&](pii A, pii B) {
        return A.fi < B.fi;
    });
    sort(b + 1, b + m + 1, [&](pii A, pii B) {
        return A.fi < B.fi;
    });
    vector <int> aa;
    for(int i = 1; i <= n; i++) aa.push_back(a[i].fi);
    mina[n + 1] = INF;
    for(int i = n; i >= 1; i--) mina[i] = min(mina[i + 1], (ll)a[i].se);
    for(int i = 1; i <= p; i++) {
        cin >> c[i].x >> c[i].y >> c[i].z;
    }
    sort(c + 1, c + p + 1);
    memset(d, INF, sizeof(d));
    for(int i = 1; i <= m; i++) {
        d[b[i].fi] = min(d[b[i].fi], (ll)b[i].se);
    }
    build(1, 1, 1e6);
    ll ans = -mina[1] - minb[1];
    for(int i = 1; i <= p; i++) {
        update(1, 1, 1e6, c[i].y + 1, 1e6, c[i].z);
        ll t = query(1, 1, 1e6, c[i].y + 1, 1e6);
        int tt = upper_bound(all(aa), c[i].x) - aa.begin() + 1;
        ans = max(ans, t - mina[tt]);
    }
    cout << ans << '\n';
}

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0); cout.tie(0);
    cout << fixed << setprecision(20);
    while(cin >> n >> m >> p) run();
    return 0;
}


/*
 * Author:  heyuhhh
 * Created Time:  2020/3/1 22:51:58
 */
#include <iostream>
#include <algorithm>
#include <cstring>
#include <vector>
#include <cmath>
#include <set>
#include <map>
#include <queue>
#include <iomanip>
#define MP make_pair
#define fi first
#define se second
#define sz(x) (int)(x).size()
#define all(x) (x).begin(), (x).end()
#define INF 0x3f3f3f3f
#define Local
#ifdef Local
  #define dbg(args...) do { cout << #args << " -> "; err(args); } while (0)
  void err() { std::cout << '\n'; }
  template<typename T, typename...Args>
  void err(T a, Args...args) { std::cout << a << ' '; err(args...); }
#else
  #define dbg(...)
#endif
void pt() {std::cout << '\n'; }
template<typename T, typename...Args>
void pt(T a, Args...args) {std::cout << a << ' '; pt(args...); }
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
//head
const int N = 1e6 + 5;

int n, m, p;
pii a[N], b[N];
ll mina[N], minb[N];

struct monster {
    int x, y, z;
    bool operator < (const monster &A) const {
        return x < A.x;
    }
}c[N];

ll maxv[N << 2], lz[N << 2];
ll d[N];

void push_up(int o) {
    maxv[o] = max(maxv[o << 1], maxv[o << 1|1]);
}

void tag(int o, int l, int r, ll v) {
    maxv[o] += v;
    lz[o] += v;
}

void push_down(int o, int l, int r) {
    if(lz[o]) {
        int mid = (l + r) >> 1;
        tag(o << 1, l, mid, lz[o]);
        tag(o << 1|1, mid + 1, r, lz[o]);
        lz[o] = 0;
    }
}

void build(int o, int l, int r) {
    if(l == r) {
        maxv[o] = -d[l];
        return;
    }
    int mid = (l + r) >> 1;
    build(o << 1, l, mid), build(o << 1|1, mid + 1, r);
    push_up(o);
}

void update(int o, int l, int r, int L, int R, ll v) {
    if(L <= l && r <= R) {
        tag(o, l, r, v);
        return;
    }
    push_down(o, l, r);
    int mid = (l + r) >> 1;
    if(L <= mid) update(o << 1, l, mid, L, R, v);
    if(R > mid) update(o << 1|1, mid + 1, r, L, R, v);
    push_up(o);
}

ll query(int o, int l, int r, int L, int R) {
    if(L <= l && r <= R) {
        return maxv[o];
    }
    push_down(o, l, r);
    int mid = (l + r) >> 1;
    ll res = -1e18;
    if(L <= mid) res = query(o << 1, l, mid, L, R);
    if(R > mid) res = max(res, query(o << 1|1, mid + 1, r, L, R));
    return res;
}

void run(){
    for(int i = 1; i <= n; i++) cin >> a[i].fi >> a[i].se;
    for(int i = 1; i <= m; i++) cin >> b[i].fi >> b[i].se;
    sort(a + 1, a + n + 1, [&](pii A, pii B) {
        return A.fi < B.fi;
    });
    sort(b + 1, b + m + 1, [&](pii A, pii B) {
        return A.fi < B.fi;
    });
    vector <int> aa;
    for(int i = 1; i <= n; i++) aa.push_back(a[i].fi);
    mina[n + 1] = INF;
    for(int i = n; i >= 1; i--) mina[i] = min(mina[i + 1], (ll)a[i].se);
    for(int i = 1; i <= p; i++) {
        cin >> c[i].x >> c[i].y >> c[i].z;
    }
    sort(c + 1, c + p + 1);
    memset(d, INF, sizeof(d));
    for(int i = 1; i <= m; i++) {
        d[b[i].fi] = min(d[b[i].fi], (ll)b[i].se);
    }
    build(1, 1, 1e6 + 1);
    ll ans = -mina[1] - minb[1];
    for(int i = 1; i <= p; i++) {
        update(1, 1, 1e6 + 1, c[i].y + 1, 1e6 + 1, c[i].z);
        ll t = query(1, 1, 1e6 + 1, c[i].y + 1, 1e6 + 1);
        int tt = upper_bound(all(aa), c[i].x) - aa.begin() + 1;
        ans = max(ans, t - mina[tt]);
    }
    cout << ans << '\n';
}

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0); cout.tie(0);
    cout << fixed << setprecision(20);
    while(cin >> n >> m >> p) run();
    return 0;
}


#include <bits/stdc++.h>

using namespace std;

int x, y, z, m, n, k, l = 1e6, r, seg[8000020], lz[8000020], ar[1000020], wp[1000020], ans = -2e9;
pair<pair<int,int>, int> a[200020];

void propagate(int id, int l, int r, int val)
{
    seg[id] += lz[id];
    lz[id*2 +1] += val;
    lz[id*2+1] += val;
    lz[id] = 0;
}

void update(int s, int e, int val, int id = 0, int l = 0, int r = 1e6)
{
    if(s >= r || e <= l) return;
    if(l >= s && r <= e)
    {
        lz[id] += val;
        propagate(id, l, r, val);
        return;
    }
    int mid = (r+l)/2;
    update(s,e,val,id*2+1,l,mid);
    update(s,e,val,id*2+2,mid,r);
    seg[id] = max(seg[id*2+1], seg[id*2+2]);
}

int main() {
    ios::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
    cin >> n >> m >> k;
    for (int i = 0; i < l; ++i)
        wp[i] = ar[i] = 1e9;
    for (int i = 0; i < n; ++i)
        cin >> x >> y, wp[x-1] = min(wp[x-1], y);
    for (int i = 0; i < m; ++i)
        cin >> x >> y, ar[x-1] = min(ar[x-1], y);
    for (int i = l-1; i > 0; --i)
        wp[i-1] = min(wp[i],wp[i-1]), ar[i-1] = min(ar[i],ar[i-1]);
    for (int i = 0; i < l; ++i)
        update(i,i+1,-ar[i]);
    for (int i = 0; i < k; ++i)
        cin >> a[i].first.first >> a[i].first.second >> a[i].second;
    sort(a,a+k);
    for (int i = 0; i < k; ++i){
        x = a[i].first.first, y = a[i].first.second, z = a[i].second;
        update(y,l,z);
        ans = max(seg[0]-wp[x], ans);
    }
    cout << ans;
}


#include <bits/stdc++.h>

using namespace std;

int x, y, z, m, n, k, l = 1e6+2, r, seg[10000080], lz[10000080], ar[1000020], wp[1000020], ans = -2e9;
pair<pair<int,int>, int> a[200020];

void propagate(int id)
{
    seg[id] += lz[id];
    lz[id*2 +1] += lz[id], lz[id*2+1] += lz[id];
    lz[id] = 0;
}

void update(int s, int e, int val, int id = 0, int l = 0, int r = 1e6+2)
{
    if(s >= r || e <= l) return;
    if(l >= s && r <= e)
    {
        lz[id] += val;
        propagate(id);
        return;
    }
    int mid = (r+l)/2;
    propagate(id);
    update(s,e,val,id*2+1,l,mid);
    update(s,e,val,id*2+2,mid,r);
    seg[id] = max(seg[id*2+1], seg[id*2+2]);
}

int main() {
    ios::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
    cin >> n >> m >> k;
    for (int i = 0; i <= l; ++i)
        wp[i] = ar[i] = 1e9+2;
    for (int i = 0; i < n; ++i)
        cin >> x >> y, wp[x-1] = min(wp[x-1], y);
    for (int i = 0; i < m; ++i)
        cin >> x >> y, ar[x-1] = min(ar[x-1], y);
    for (int i = l-1; i > 0; --i)
        wp[i-1] = min(wp[i],wp[i-1]), ar[i-1] = min(ar[i],ar[i-1]);
    for (int i = 0; i < l; ++i)
        update(i,i+1,-ar[i]);
    for (int i = 0; i < k; ++i)
        cin >> a[i].first.first >> a[i].first.second >> a[i].second;
    sort(a,a+k);
    for (int i = 0; i < k; ++i){
        x = a[i].first.first, y = a[i].first.second, z = a[i].second;
        update(y,l,z);
        ans = max(seg[0]-wp[x], ans);
    }
    cout << ans;
}


#include <bits/stdc++.h>

using namespace std;

long long x, y, z, m, n, k, l = 1e6+2, r, seg[8000080], lz[8000080], ar[1000020], wp[1000020], ans;
pair<pair<int,int>, int> a[200020];

void propagate(int id)
{
    seg[id] += lz[id];
    lz[id*2 +1] += lz[id], lz[id*2+2] += lz[id];
    lz[id] = 0;
}

void update(int s, int e, int val, int id = 0, int l = 0, int r = 1e6+2)
{
    if(s >= r || e <= l) return;
    if(l >= s && r <= e)
    {
        lz[id] += val;
        propagate(id);
        return;
    }
    int mid = (r+l)/2;
    propagate(id);
    update(s,e,val,id*2+1,l,mid);
    update(s,e,val,id*2+2,mid,r);
    seg[id] = max(seg[id*2+1], seg[id*2+2]);
}

int main() {
    ios::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
    cin >> n >> m >> k;
    for (int i = 0; i <= l; ++i)
        wp[i] = ar[i] = 2e9+2;
    for (int i = 0; i < n; ++i)
        cin >> x >> y, wp[x-1] = min(wp[x-1], y);
    for (int i = 0; i < m; ++i)
        cin >> x >> y, ar[x-1] = min(ar[x-1], y);
    for (int i = l-1; i > 0; --i)
        wp[i-1] = min(wp[i],wp[i-1]), ar[i-1] = min(ar[i],ar[i-1]);
    for (int i = 0; i < l; ++i)
        update(i,i+1,-ar[i]);
    for (int i = 0; i < k; ++i)
        cin >> a[i].first.first >> a[i].first.second >> a[i].second;
    sort(a,a+k);
    ans = -ar[0] -wp[0];
    for (int i = 0; i < k; ++i){
        x = a[i].first.first, y = a[i].first.second, z = a[i].second;
        update(y,l,z);
        ans = max(seg[0]-wp[x], ans);
    }
    cout << ans;
}


#include <bits/stdc++.h>

using namespace std;

int x, y, z, m, n, k, l = 1e6+2, r, seg[8000080], lz[8000080], ar[1000020], wp[1000020], ans = -2e9-5;
pair<pair<int,int>, int> a[200020];

void propagate(int id)
{
    seg[id] += lz[id];
    lz[id*2 +1] += lz[id], lz[id*2+2] += lz[id];
    lz[id] = 0;
}

void update(int s, int e, int val, int id = 0, int l = 0, int r = 1e6+2)
{
    if(s >= r || e <= l) return;
    if(l >= s && r <= e)
    {
        lz[id] += val;
        propagate(id);
        return;
    }
    int mid = (r+l)/2;
    propagate(id);
    update(s,e,val,id*2+1,l,mid);
    update(s,e,val,id*2+2,mid,r);
    seg[id] = max(seg[id*2+1], seg[id*2+2]);
}

int main() {
    ios::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
    cin >> n >> m >> k;
    for (int i = 0; i <= l; ++i)
        wp[i] = ar[i] = 2e9+2;
    for (int i = 0; i < n; ++i)
        cin >> x >> y, wp[x-1] = min(wp[x-1], y);
    for (int i = 0; i < m; ++i)
        cin >> x >> y, ar[x-1] = min(ar[x-1], y);
    for (int i = l-1; i > 0; --i)
        wp[i-1] = min(wp[i],wp[i-1]), ar[i-1] = min(ar[i],ar[i-1]);
    for (int i = 0; i < l; ++i)
        update(i,i+1,-ar[i]);
    for (int i = 0; i < k; ++i)
        cin >> a[i].first.first >> a[i].first.second >> a[i].second;
    sort(a,a+k);
    for (int i = 0; i < k; ++i){
        x = a[i].first.first, y = a[i].first.second, z = a[i].second;
        update(y,l,z);
        ans = max(seg[0]-wp[x], ans);
    }
    cout << ans;
}


#include <bits/stdc++.h>

using namespace std;

int x, y, z, m, n, k, l = 1e6, r, seg[8000020], lz[8000020], ar[1000020], wp[1000020], ans = -2e9;
pair<pair<int,int>, int> a[200020];

void propagate(int id, int l, int r, int val)
{
    seg[id] += lz[id];
    lz[id*2 +1] += val;
    lz[id*2+1] += val;
    lz[id] = 0;
}

void update(int s, int e, int val, int id = 0, int l = 0, int r = 1e6)
{
    if(s >= r || e <= l) return;
    if(l >= s && r <= e)
    {
        lz[id] += val;
        propagate(id, l, r, val);
        return;
    }
    int mid = (r+l)/2;
    update(s,e,val,id*2+1,l,mid);
    update(s,e,val,id*2+2,mid,r);
    seg[id] = max(seg[id*2+1], seg[id*2+2]);
}

int main() {
    ios::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
    cin >> n >> m >> k;
    for (int i = 0; i < l; ++i)
        wp[i] = ar[i] = 1e9;
    for (int i = 0; i < n; ++i)
        cin >> x >> y, ar[x-1] = min(ar[x-1], y);
    for (int i = 0; i < m; ++i)
        cin >> x >> y, wp[x-1] = min(wp[x-1], y);
    for (int i = l-1; i > 0; --i)
        wp[i-1] = min(wp[i],wp[i-1]), ar[i-1] = min(ar[i],ar[i-1]);
    for (int i = 0; i < l; ++i)
        update(i,i+1,-ar[i]);
    for (int i = 0; i < k; ++i)
        cin >> a[i].first.first >> a[i].first.second >> a[i].second;
    sort(a,a+k);
    for (int i = 0; i < k; ++i){
        x = a[i].first.first, y = a[i].first.second, z = a[i].second;
        update(y,l,z);
        ans = max(seg[0]-wp[x], ans);
    }
    cout << ans;
}


#include <bits/stdc++.h>

using namespace std;

int x, y, z, m, n, k, l = 1e6, r, seg[8000020], lz[8000020], ar[1000020], wp[1000020], ans = -2e9;
pair<pair<int,int>, int> a[200020];

void propagate(int id)
{
    seg[id] += lz[id];
    lz[id*2 +1] += lz[id], lz[id*2+1] += lz[id];
    lz[id] = 0;
}

void update(int s, int e, int val, int id = 0, int l = 0, int r = 1e6)
{
    if(s >= r || e <= l) return;
    if(l >= s && r <= e)
    {
        lz[id] += val;
        propagate(id);
        return;
    }
    int mid = (r+l)/2;
    propagate(id);
    update(s,e,val,id*2+1,l,mid);
    update(s,e,val,id*2+2,mid,r);
    seg[id] = max(seg[id*2+1], seg[id*2+2]);
}

int main() {
    ios::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
    cin >> n >> m >> k;
    for (int i = 0; i < l; ++i)
        wp[i] = ar[i] = 1e9;
    for (int i = 0; i < n; ++i)
        cin >> x >> y, wp[x-1] = min(wp[x-1], y);
    for (int i = 0; i < m; ++i)
        cin >> x >> y, ar[x-1] = min(ar[x-1], y);
    for (int i = l-1; i > 0; --i)
        wp[i-1] = min(wp[i],wp[i-1]), ar[i-1] = min(ar[i],ar[i-1]);
    for (int i = 0; i < l; ++i)
        update(i,i+1,-ar[i]);
    for (int i = 0; i < k; ++i)
        cin >> a[i].first.first >> a[i].first.second >> a[i].second;
    sort(a,a+k);
    for (int i = 0; i < k; ++i){
        x = a[i].first.first, y = a[i].first.second, z = a[i].second;
        update(y,l,z);
        ans = max(seg[0]-wp[x], ans);
    }
    cout << ans;
}


#include <bits/stdc++.h>

using namespace std;

long long x, y, z, m, n, k, l = 1e6+2, r, seg[8000080], lz[8000080], ar[1000020], wp[1000020], ans = -2e9;
pair<pair<int,int>, int> a[200020];

void propagate(int id)
{
    seg[id] += lz[id];
    lz[id*2 +1] += lz[id], lz[id*2+2] += lz[id];
    lz[id] = 0;
}

void update(int s, int e, int val, int id = 0, int l = 0, int r = 1e6+2)
{
    if(s >= r || e <= l) return;
    if(l >= s && r <= e)
    {
        lz[id] += val;
        propagate(id);
        return;
    }
    int mid = (r+l)/2;
    propagate(id);
    update(s,e,val,id*2+1,l,mid);
    update(s,e,val,id*2+2,mid,r);
    seg[id] = max(seg[id*2+1], seg[id*2+2]);
}

int main() {
    ios::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
    cin >> n >> m >> k;
    for (int i = 0; i <= l; ++i)
        wp[i] = ar[i] = 4e9+2;
    for (int i = 0; i < n; ++i)
        cin >> x >> y, wp[x-1] = min(wp[x-1], y);
    for (int i = 0; i < m; ++i)
        cin >> x >> y, ar[x-1] = min(ar[x-1], y);
    for (int i = l-1; i > 0; --i)
        wp[i-1] = min(wp[i],wp[i-1]), ar[i-1] = min(ar[i],ar[i-1]);
    for (int i = 0; i < l; ++i)
        update(i,i+1,-ar[i]);
    for (int i = 0; i < k; ++i)
        cin >> a[i].first.first >> a[i].first.second >> a[i].second;
    sort(a,a+k);
    for (int i = 0; i < k; ++i){
        x = a[i].first.first, y = a[i].first.second, z = a[i].second;
        update(y,l,z);
        ans = max(seg[0]-wp[x], ans);
    }
    cout << ans;
}


#include <bits/stdc++.h>

using namespace std;

int x, y, z, m, n, k, l = 1e6+2, r, seg[8000080], lz[8000080], ar[1000020], wp[1000020], ans = -2e9;
pair<pair<int,int>, int> a[200020];

void propagate(int id)
{
    seg[id] += lz[id];
    lz[id*2 +1] += lz[id], lz[id*2+2] += lz[id];
    lz[id] = 0;
}

void update(int s, int e, int val, int id = 0, int l = 0, int r = 1e6+2)
{
    if(s >= r || e <= l) return;
    if(l >= s && r <= e)
    {
        lz[id] += val;
        propagate(id);
        return;
    }
    int mid = (r+l)/2;
    propagate(id);
    update(s,e,val,id*2+1,l,mid);
    update(s,e,val,id*2+2,mid,r);
    seg[id] = max(seg[id*2+1], seg[id*2+2]);
}

int main() {
    ios::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
    cin >> n >> m >> k;
    for (int i = 0; i <= l; ++i)
        wp[i] = ar[i] = 1e9+2;
    for (int i = 0; i < n; ++i)
        cin >> x >> y, wp[x-1] = min(wp[x-1], y);
    for (int i = 0; i < m; ++i)
        cin >> x >> y, ar[x-1] = min(ar[x-1], y);
    for (int i = l-1; i > 0; --i)
        wp[i-1] = min(wp[i],wp[i-1]), ar[i-1] = min(ar[i],ar[i-1]);
    for (int i = 0; i < l; ++i)
        update(i,i+1,-ar[i]);
    for (int i = 0; i < k; ++i)
        cin >> a[i].first.first >> a[i].first.second >> a[i].second;
    sort(a,a+k);
    for (int i = 0; i < k; ++i){
        x = a[i].first.first, y = a[i].first.second, z = a[i].second;
        update(y,l,z);
        ans = max(seg[0]-wp[x], ans);
    }
    cout << ans;
}


#include <bits/stdc++.h>

using namespace std;

int x, y, z, m, n, k, l = 1e6, r, seg[4000020], lz[4000020], ar[1000020], wp[1000020], ans = -2e9;
pair<pair<int,int>, int> a[200020];

void propagate(int id, int l, int r, int val)
{
    seg[id] += lz[id];
    lz[id*2 +1] += val;
    lz[id*2+1] += val;
    lz[id] = 0;
}

void update(int s, int e, int val, int id = 0, int l = 0, int r = 1e6)
{
    if(s >= r || e <= l) return;
    if(l >= s && r <= e)
    {
        lz[id] += val;
        propagate(id, l, r, val);
        return;
    }
    int mid = (r+l)/2;
    update(s,e,val,id*2+1,l,mid);
    update(s,e,val,id*2+2,mid,r);
    seg[id] = max(seg[id*2+1], seg[id*2+2]);
}

int main() {
    ios::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
    cin >> n >> m >> k;
    for (int i = 0; i < l; ++i)
        wp[i] = ar[i] = 1e9;
    for (int i = 0; i < n; ++i)
        cin >> x >> y, ar[x-1] = min(ar[x-1], y);
    for (int i = 0; i < m; ++i)
        cin >> x >> y, wp[x-1] = min(wp[x-1], y);
    for (int i = l-1; i > 0; --i)
        wp[i-1] = min(wp[i],wp[i-1]), ar[i-1] = min(ar[i],ar[i-1]);
    for (int i = 0; i < l; ++i)
        update(i,i+1,-ar[i]);
    for (int i = 0; i < k; ++i)
        cin >> a[i].first.first >> a[i].first.second >> a[i].second;
    sort(a,a+k);
    for (int i = 0; i < k; ++i){
        x = a[i].first.first, y = a[i].first.second, z = a[i].second;
        update(y,l,z);
        ans = max(seg[0]-wp[x], ans);
    }
    cout << ans;
}


#include <bits/stdc++.h>

using namespace std;

long long x, y, z, m, n, k, l = 1e6+2, r, seg[8000080], lz[8000080], ar[1000020], wp[1000020], ans;
pair<pair<int,int>, int> a[200020];

void propagate(int id)
{
    seg[id] += lz[id];
    lz[id*2 +1] += lz[id], lz[id*2+2] += lz[id];
    lz[id] = 0;
}

void update(int s, int e, int val, int id = 0, int l = 0, int r = 1e6+2)
{
    propagate(id);
    if(s >= r || e <= l) return;
    if(l >= s && r <= e)
    {
        lz[id] += val;
        propagate(id);
        return;
    }
    int mid = (r+l)/2;
    update(s,e,val,id*2+1,l,mid);
    update(s,e,val,id*2+2,mid,r);
    seg[id] = max(seg[id*2+1], seg[id*2+2]);
}

int main() {
    ios::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
    cin >> n >> m >> k;
    for (int i = 0; i <= l; ++i)
        wp[i] = ar[i] = 2e9+2;
    for (int i = 0; i < n; ++i)
        cin >> x >> y, wp[x-1] = min(wp[x-1], y);
    for (int i = 0; i < m; ++i)
        cin >> x >> y, ar[x-1] = min(ar[x-1], y);
    for (int i = l-1; i > 0; --i)
        wp[i-1] = min(wp[i],wp[i-1]), ar[i-1] = min(ar[i],ar[i-1]);
    for (int i = 0; i < l; ++i)
        update(i,i+1,-ar[i]);
    for (int i = 0; i < k; ++i)
        cin >> a[i].first.first >> a[i].first.second >> a[i].second;
    sort(a,a+k);
    ans = -ar[0] -wp[0];
    for (int i = 0; i < k; ++i){
        x = a[i].first.first, y = a[i].first.second, z = a[i].second;
        update(y,l,z);
        ans = max(seg[0]-wp[x], ans);
    }
    cout << ans;
}


#include <bits/stdc++.h>

using namespace std;

long long x, y, z, m, n, k, l = 1e6+2, r, seg[8000080], lz[8000080], ar[1000020], wp[1000020], ans = -2e9;
pair<pair<int,int>, int> a[200020];

void propagate(int id)
{
    seg[id] += lz[id];
    lz[id*2 +1] += lz[id], lz[id*2+2] += lz[id];
    lz[id] = 0;
}

void update(int s, int e, int val, int id = 0, int l = 0, int r = 1e6+2)
{
    if(s >= r || e <= l) return;
    if(l >= s && r <= e)
    {
        lz[id] += val;
        propagate(id);
        return;
    }
    int mid = (r+l)/2;
    propagate(id);
    update(s,e,val,id*2+1,l,mid);
    update(s,e,val,id*2+2,mid,r);
    seg[id] = max(seg[id*2+1], seg[id*2+2]);
}

int main() {
    ios::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
    cin >> n >> m >> k;
    for (int i = 0; i <= l; ++i)
        wp[i] = ar[i] = 2e9+2;
    for (int i = 0; i < n; ++i)
        cin >> x >> y, wp[x-1] = min(wp[x-1], y);
    for (int i = 0; i < m; ++i)
        cin >> x >> y, ar[x-1] = min(ar[x-1], y);
    for (int i = l-1; i > 0; --i)
        wp[i-1] = min(wp[i],wp[i-1]), ar[i-1] = min(ar[i],ar[i-1]);
    for (int i = 0; i < l; ++i)
        update(i,i+1,-ar[i]);
    for (int i = 0; i < k; ++i)
        cin >> a[i].first.first >> a[i].first.second >> a[i].second;
    sort(a,a+k);
    for (int i = 0; i < k; ++i){
        x = a[i].first.first, y = a[i].first.second, z = a[i].second;
        update(y,l,z);
        ans = max(seg[0]-wp[x], ans);
    }
    cout << ans;
}


#include <bits/stdc++.h>

using namespace std;

int x, y, z, m, n, k, l = 1e6, r, seg[10000080], lz[10000080], ar[1000020], wp[1000020], ans = -2e9;
pair<pair<int,int>, int> a[200020];

void propagate(int id)
{
    seg[id] += lz[id];
    lz[id*2 +1] += lz[id], lz[id*2+1] += lz[id];
    lz[id] = 0;
}

void update(int s, int e, int val, int id = 0, int l = 0, int r = 1e6)
{
    if(s >= r || e <= l) return;
    if(l >= s && r <= e)
    {
        lz[id] += val;
        propagate(id);
        return;
    }
    int mid = (r+l)/2;
    propagate(id);
    update(s,e,val,id*2+1,l,mid);
    update(s,e,val,id*2+2,mid,r);
    seg[id] = max(seg[id*2+1], seg[id*2+2]);
}

int main() {
    ios::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
    cin >> n >> m >> k;
    for (int i = 0; i < l; ++i)
        wp[i] = ar[i] = 1e9;
    for (int i = 0; i < n; ++i)
        cin >> x >> y, wp[x-1] = min(wp[x-1], y);
    for (int i = 0; i < m; ++i)
        cin >> x >> y, ar[x-1] = min(ar[x-1], y);
    for (int i = l-1; i > 0; --i)
        wp[i-1] = min(wp[i],wp[i-1]), ar[i-1] = min(ar[i],ar[i-1]);
    for (int i = 0; i < l; ++i)
        update(i,i+1,-ar[i]);
    for (int i = 0; i < k; ++i)
        cin >> a[i].first.first >> a[i].first.second >> a[i].second;
    sort(a,a+k);
    for (int i = 0; i < k; ++i){
        x = a[i].first.first, y = a[i].first.second, z = a[i].second;
        update(y,l,z);
        ans = max(seg[0]-wp[x], ans);
    }
    cout << ans;
}


#include <bits/stdc++.h>

using namespace std;

long long x, y, z, m, n, k, l = 1e6+2, r, seg[8000080], lz[8000080], ar[1000020], wp[1000020], ans = -2e9-5;
pair<pair<int,int>, int> a[200020];

void propagate(int id)
{
    seg[id] += lz[id];
    lz[id*2 +1] += lz[id], lz[id*2+2] += lz[id];
    lz[id] = 0;
}

void update(int s, int e, int val, int id = 0, int l = 0, int r = 1e6+2)
{
    if(s >= r || e <= l) return;
    if(l >= s && r <= e)
    {
        lz[id] += val;
        propagate(id);
        return;
    }
    int mid = (r+l)/2;
    propagate(id);
    update(s,e,val,id*2+1,l,mid);
    update(s,e,val,id*2+2,mid,r);
    seg[id] = max(seg[id*2+1], seg[id*2+2]);
}

int main() {
    ios::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
    cin >> n >> m >> k;
    for (int i = 0; i <= l; ++i)
        wp[i] = ar[i] = 2e9+2;
    for (int i = 0; i < n; ++i)
        cin >> x >> y, wp[x-1] = min(wp[x-1], y);
    for (int i = 0; i < m; ++i)
        cin >> x >> y, ar[x-1] = min(ar[x-1], y);
    for (int i = l-1; i > 0; --i)
        wp[i-1] = min(wp[i],wp[i-1]), ar[i-1] = min(ar[i],ar[i-1]);
    for (int i = 0; i < l; ++i)
        update(i,i+1,-ar[i]);
    for (int i = 0; i < k; ++i)
        cin >> a[i].first.first >> a[i].first.second >> a[i].second;
    sort(a,a+k);
    for (int i = 0; i < k; ++i){
        x = a[i].first.first, y = a[i].first.second, z = a[i].second;
        update(y,l,z);
        ans = max(seg[0]-wp[x], ans);
    }
    cout << ans;
}


#include <bits/stdc++.h>
#define FAST ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
typedef int ll;
typedef long double ld;
#define pb push_back
#define mp make_pair
#define ff first
#define ss second
#define mod 1000000007
#define inf 2000000005
#define bpc(x) __builtin_parityll(x)
#define autoit(x,it) for(auto it = x.begin(); it != x.end(); it++)
#define rep(n) for(ll i = 0; i < n; i++)
#define repi(i,n) for(ll i = 0; i < n; i++)

#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;

#define ordered_set tree<ll, null_type,less<ll>, rb_tree_tag,tree_order_statistics_node_update>

using namespace std;

ll n,m;

void push(int st[], int lazy[], int v) {
    st[v*2+1] += lazy[v];
    lazy[v*2+1] += lazy[v];
    st[v*2+2] += lazy[v];
    lazy[v*2+2] += lazy[v];
    lazy[v] = 0;
}

void upd(int st[], int lazy[],int v, int tl, int tr, int l, int r, int addend) {
    if (l > r)
        return;
    if (l == tl && tr == r) {
        st[v] += addend;
        lazy[v] += addend;
    } else {
        push(st,lazy,v);
        int tm = (tl + tr) / 2;
        upd(st,lazy,v*2+1, tl, tm, l, min(r, tm), addend);
        upd(st,lazy,v*2+2, tm+1, tr, max(l, tm+1), r, addend);
        st[v] = max(st[v*2+1], st[v*2+2]);
    }
}

int query(int st[], int lazy[],int v, int tl, int tr, int l, int r) {
    if (l > r)
        return -inf;
    if (l <= tl && tr <= r)
        return st[v];
    push(st,lazy,v);
    int tm = (tl + tr) / 2;
    return max(query(st,lazy,v*2+1, tl, tm, l, min(r, tm)),
               query(st,lazy,v*2+2, tm+1, tr, max(l, tm+1), r));
}

void build(ll st[], ll l, ll r, pair<ll,ll> arr1[], ll i)
{
    if(l == r)
    {
        ll maxi = inf;
        repi(j,m)
            if(arr1[j].ff>l && arr1[j].ss<maxi)
                maxi = arr1[j].ss;
        st[i] = -maxi;
        return;
    }

    ll mid = (l+r)/2;
    build(st,l,mid,arr1,2*i+1);
    build(st,mid+1,r,arr1,2*i+2);
    st[i] = max(st[2*i+1], st[2*i+2]);
}

int main()
{
   FAST/**/

   ll p;
   cin>>n>>m>>p;

   pair<ll,ll> arr[200005], arr1[200005];
   rep(n)
        cin>>arr[i].ff>>arr[i].ss;
   rep(m)
        cin>>arr1[i].ff>>arr1[i].ss;

   map<ll,ll> ma;
   set<ll> ste;
   rep(m)
        ste.insert(arr1[i].ff);

   pair<pair<ll,ll>,ll> hold[p];
   rep(p)
        cin>>hold[i].ff.ff>>hold[i].ff.ss>>hold[i].ss, ste.insert(hold[i].ff.ss);

   if(m>n)
   {
       rep(n)
            swap(arr[i], arr1[i]);
       rep(p)
            swap(hold[i].ff.ff,hold[i].ff.ss);
       swap(n,m);
   }

   vector<ll> he;
   autoit(ste,it)
        he.pb(*it);
   ll curr = 1;
   rep(he.size())
   {
       ma[he[i]] = curr;
       curr++;
   }

   rep(m)
        arr1[i].ff = ma[arr1[i].ff];
   rep(p)
        hold[i].ff.ss = ma[hold[i].ff.ss];

   sort(hold,hold+p);
   sort(arr,arr+n);

   ll lim = ma.size();

   ll ht = ceil(log2(lim));
   ht = (1ll<<(ht + 1)) - 1;
   ll st[ht];
   ll lazy[ht];
   memset(lazy,0,sizeof(lazy));

   build(st,1,lim,arr1,0);

   ll pe = 0;

   ll ans = -inf;
   rep(n)
   {
       //vector<pair<ll,ll>> v1;
       while(pe<p && hold[pe].ff.ff<arr[i].ff)
       {
           upd(st,lazy,0,1,lim,hold[pe].ff.ss,lim,hold[pe].ss);
           //v1.pb(mp(hold[pe].ff.ss,hold[pe].ss));
           pe++;
       }

       ans = max(ans, st[0]-arr[i].ss);
   }
   cout<<ans;

   return 0;
}


#include <bits/stdc++.h>
#define FAST ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
typedef long long ll;
typedef long double ld;
#define pb push_back
#define mp make_pair
#define ff first
#define ss second
#define mod 1000000007
#define inf 1000000000000000000
#define bpc(x) __builtin_parityll(x)
#define autoit(x,it) for(auto it = x.begin(); it != x.end(); it++)
#define rep(n) for(ll i = 0; i < n; i++)
#define repi(i,n) for(ll i = 0; i < n; i++)

#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;

#define ordered_set tree<ll, null_type,less<ll>, rb_tree_tag,tree_order_statistics_node_update>

using namespace std;

ll n,m;

void upd(ll st[],ll lazy[], ll l, ll r, ll i, ll l1, ll r1, ll val)
{
    if (lazy[i] != 0)
    {
        st[i]+=lazy[i];

        if (l != r)
        {
            lazy[i*2 + 1]   += lazy[i];
            lazy[i*2 + 2]   += lazy[i];
        }

        lazy[i] = 0;
    }

    if (l>r || l>r1 || r<l1)
        return ;

    if (l>=l1 && r<=r1)
    {
        st[i]+=val;

        if (l != r)
        {
            lazy[i*2 + 1]   += val;
            lazy[i*2 + 2]   += val;
        }
        return;
    }

    ll mid = (l+r)/2;
    upd(st,lazy, l, mid, 2*i+1, l1, r1, val);
    upd(st,lazy, mid+1, r, 2*i+2, l1, r1, val);

    st[i] = max(st[2*i+1] , st[2*i+2]);

}

ll quer(ll st[],ll lazy[], ll l, ll r, ll i, ll l1, ll r1)
{
    if (lazy[i] != 0)
    {

        st[i]+=lazy[i];

        if (l != r)
        {
            lazy[i*2 + 1]   += lazy[i];
            lazy[i*2 + 2]   += lazy[i];
        }

        lazy[i] = 0;
    }

    if (l>r || l>r1 || r<l1)
        return -inf;

    if(l1<=l && r1>=r)
        return st[i];

    if(l == r)
        return st[i];

    ll mid = (l+r)/2;
    ll p1 = quer(st,lazy, l, mid,2*i+1, l1, r1);
    ll p2 = quer(st,lazy, mid+1, r,2*i+2, l1, r1);

    return max(p1,p2);
}

void build(ll st[], ll l, ll r, pair<ll,ll> arr1[], ll i)
{
    if(l == r)
    {
        ll maxi = inf;
        repi(j,m)
            if(arr1[j].ff>l && arr1[j].ss<maxi)
                maxi = arr1[j].ss;
        st[i] = -maxi;
        return;
    }

    ll mid = (l+r)/2;
    build(st,l,mid,arr1,2*i+1);
    build(st,mid+1,r,arr1,2*i+2);
    st[i] = max(st[2*i+1], st[2*i+2]);
}

int main()
{
   FAST/**/

   ll p;
   cin>>n>>m>>p;

   pair<ll,ll> arr[n], arr1[m];
   rep(n)
        cin>>arr[i].ff>>arr[i].ss;
   rep(m)
        cin>>arr1[i].ff>>arr1[i].ss;

   pair<pair<ll,ll>,ll> hold[p];
   rep(p)
        cin>>hold[i].ff.ff>>hold[i].ff.ss>>hold[i].ss;

   sort(hold,hold+p);
   sort(arr,arr+n);
   sort(arr1,arr1+m);

   ll ht = ceil(log2(1000005));
   ht = (1ll<<(ht + 1)) - 1;
   ll st[ht];
   ll lazy[ht];
   memset(lazy,0,sizeof(lazy));

   build(st,1,1000005,arr1,0);

   ll pe = 0;

   ll ans = -inf;
   rep(n)
   {
       vector<pair<ll,ll>> v1;
       while(pe<p && hold[pe].ff.ff<arr[i].ff)
       {
           v1.pb(mp(hold[pe].ff.ss,hold[pe].ss));
           pe++;
       }

       repi(j,v1.size())
           upd(st,lazy,1,1000005,0,v1[j].ff,1000005,v1[j].ss);
       ans = max(ans, st[0]-arr[i].ss);
   }
   cout<<ans;

   return 0;
}


#include <bits/stdc++.h>
#define FAST ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
typedef long long ll;
typedef long double ld;
#define pb push_back
#define mp make_pair
#define ff first
#define ss second
#define mod 1000000007
#define inf 1000000000000000000
#define bpc(x) __builtin_parityll(x)
#define autoit(x,it) for(auto it = x.begin(); it != x.end(); it++)
#define rep(n) for(ll i = 0; i < n; i++)
#define repi(i,n) for(ll i = 0; i < n; i++)

#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;

#define ordered_set tree<ll, null_type,less<ll>, rb_tree_tag,tree_order_statistics_node_update>

using namespace std;

ll n,m;

void upd(ll st[],ll lazy[], ll l, ll r, ll i, ll l1, ll r1, ll val)
{
    if (lazy[i] != 0)
    {
        st[i]+=lazy[i];

        if (l != r)
        {
            lazy[i*2 + 1]   += lazy[i];
            lazy[i*2 + 2]   += lazy[i];
        }

        lazy[i] = 0;
    }

    if (l>r || l>r1 || r<l1)
        return ;

    if (l>=l1 && r<=r1)
    {
        st[i]+=val;

        if (l != r)
        {
            lazy[i*2 + 1]   += val;
            lazy[i*2 + 2]   += val;
        }
        return;
    }

    ll mid = (l+r)/2;
    upd(st,lazy, l, mid, 2*i+1, l1, r1, val);
    upd(st,lazy, mid+1, r, 2*i+2, l1, r1, val);

    st[i] = max(st[2*i+1] , st[2*i+2]);

}

ll quer(ll st[],ll lazy[], ll l, ll r, ll i, ll l1, ll r1)
{
    if (lazy[i] != 0)
    {

        st[i]+=lazy[i];

        if (l != r)
        {
            lazy[i*2 + 1]   += lazy[i];
            lazy[i*2 + 2]   += lazy[i];
        }

        lazy[i] = 0;
    }

    if (l>r || l>r1 || r<l1)
        return -inf;

    if(l1<=l && r1>=r)
        return st[i];

    if(l == r)
        return st[i];

    ll mid = (l+r)/2;
    ll p1 = quer(st,lazy, l, mid,2*i+1, l1, r1);
    ll p2 = quer(st,lazy, mid+1, r,2*i+2, l1, r1);

    return max(p1,p2);
}

void build(ll st[], ll l, ll r, pair<ll,ll> arr1[], ll i)
{
    if(l == r)
    {
        ll maxi = inf;
        repi(j,m)
            if(arr1[j].ff>l && arr1[j].ss<maxi)
                maxi = arr1[j].ss;
        st[i] = -maxi;
        return;
    }

    ll mid = (l+r)/2;
    build(st,l,mid,arr1,2*i+1);
    build(st,mid+1,r,arr1,2*i+2);
    st[i] = max(st[2*i+1], st[2*i+2]);
}

int main()
{
   FAST/**/

   ll p;
   cin>>n>>m>>p;

   pair<ll,ll> arr[n], arr1[m];
   rep(n)
        cin>>arr[i].ff>>arr[i].ss;
   rep(m)
        cin>>arr1[i].ff>>arr1[i].ss;

   pair<pair<ll,ll>,ll> hold[p];
   rep(p)
        cin>>hold[i].ff.ff>>hold[i].ff.ff>>hold[i].ss;

   sort(hold,hold+p);
   sort(arr,arr+n);
   sort(arr1,arr1+m);

   ll ht = ceil(log2(1000));
   ht = (1ll<<(ht + 1)) - 1;
   ll st[ht];
   ll lazy[ht];
   memset(lazy,0,sizeof(lazy));

   build(st,1,1000,arr1,0);

   ll pe = 0;

   ll ans = -inf;
   rep(n)
   {
       vector<pair<ll,ll>> v1;
       while(pe<p && hold[pe].ff.ff<arr[i].ff)
       {
           v1.pb(mp(hold[pe].ff.ss,hold[pe].ss));
           pe++;
       }

       repi(j,v1.size())
           upd(st,lazy,1,1000,0,v1[j].ff,1000,v1[j].ss);
       ans = max(ans, st[0]-arr[i].ss);
   }
   cout<<ans;

   return 0;
}


#include <bits/stdc++.h>
#define FAST ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
typedef int ll;
typedef long double ld;
#define pb push_back
#define mp make_pair
#define ff first
#define ss second
#define mod 1000000007
#define inf 2000000005
#define bpc(x) __builtin_parityll(x)
#define autoit(x,it) for(auto it = x.begin(); it != x.end(); it++)
#define rep(n) for(ll i = 0; i < n; i++)
#define repi(i,n) for(ll i = 0; i < n; i++)

#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;

#define ordered_set tree<ll, null_type,less<ll>, rb_tree_tag,tree_order_statistics_node_update>

using namespace std;

ll n,m;

void push(int st[], int lazy[], int v) {
    st[v*2+1] += lazy[v];
    lazy[v*2+1] += lazy[v];
    st[v*2+2] += lazy[v];
    lazy[v*2+2] += lazy[v];
    lazy[v] = 0;
}

void upd(int st[], int lazy[],int v, int tl, int tr, int l, int r, int addend) {
    if (l > r)
        return;
    if (l == tl && tr == r) {
        st[v] += addend;
        lazy[v] += addend;
    } else {
        push(st,lazy,v);
        int tm = (tl + tr) / 2;
        upd(st,lazy,v*2+1, tl, tm, l, min(r, tm), addend);
        upd(st,lazy,v*2+2, tm+1, tr, max(l, tm+1), r, addend);
        st[v] = max(st[v*2+1], st[v*2+2]);
    }
}

int query(int st[], int lazy[],int v, int tl, int tr, int l, int r) {
    if (l > r)
        return -inf;
    if (l <= tl && tr <= r)
        return st[v];
    push(st,lazy,v);
    int tm = (tl + tr) / 2;
    return max(query(st,lazy,v*2+1, tl, tm, l, min(r, tm)),
               query(st,lazy,v*2+2, tm+1, tr, max(l, tm+1), r));
}

void build(ll st[], ll l, ll r, pair<ll,ll> arr1[], ll i)
{
    if(l == r)
    {
        ll maxi = inf;
        repi(j,m)
            if(arr1[j].ff>l && arr1[j].ss<maxi)
                maxi = arr1[j].ss;
        st[i] = -maxi;
        return;
    }

    ll mid = (l+r)/2;
    build(st,l,mid,arr1,2*i+1);
    build(st,mid+1,r,arr1,2*i+2);
    st[i] = max(st[2*i+1], st[2*i+2]);
}

int main()
{
   FAST/**/

   ll p;
   cin>>n>>m>>p;

   pair<ll,ll> arr[n], arr1[m];
   rep(n)
        cin>>arr[i].ff>>arr[i].ss;
   rep(m)
        cin>>arr1[i].ff>>arr1[i].ss;

   /*map<ll,ll> ma;
   set<ll> ste;
   rep(m)
        ste.insert(arr1[i].ff);*/

   pair<pair<ll,ll>,ll> hold[p];
   rep(p)
        cin>>hold[i].ff.ff>>hold[i].ff.ss>>hold[i].ss;// ste.insert(hold[i].ff.ss);
   /*vector<ll> he;
   autoit(ste,it)
        he.pb(*it);
   ll curr = 1;
   rep(he.size())
   {
       ma[he[i]] = curr;
       curr++;
   }

   rep(m)
        arr1[i].ff = ma[arr1[i].ff];
   rep(p)
        hold[i].ff.ss = ma[hold[i].ff.ss];*/

   sort(hold,hold+p);
   sort(arr,arr+n);

   ll lim = 1000000;

   ll ht = ceil(log2(lim));
   ht = (1ll<<(ht + 1)) - 1;
   ll st[ht];
   ll lazy[ht];
   memset(lazy,0,sizeof(lazy));

   build(st,1,lim,arr1,0);

   ll pe = 0;

   ll ans = -inf;
   rep(n)
   {
       //vector<pair<ll,ll>> v1;
       while(pe<p && hold[pe].ff.ff<arr[i].ff)
       {
           upd(st,lazy,0,1,lim,hold[pe].ff.ss,lim,hold[pe].ss);
           //v1.pb(mp(hold[pe].ff.ss,hold[pe].ss));
           pe++;
       }

       ans = max(ans, st[0]-arr[i].ss);
   }
   cout<<ans;

   return 0;
}


#include <bits/stdc++.h>
#define FAST ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
typedef int ll;
typedef long double ld;
#define pb push_back
#define mp make_pair
#define ff first
#define ss second
#define mod 1000000007
#define inf 2000000005
#define bpc(x) __builtin_parityll(x)
#define autoit(x,it) for(auto it = x.begin(); it != x.end(); it++)
#define rep(n) for(ll i = 0; i < n; i++)
#define repi(i,n) for(ll i = 0; i < n; i++)

#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;

#define ordered_set tree<ll, null_type,less<ll>, rb_tree_tag,tree_order_statistics_node_update>

using namespace std;

ll n,m;

void push(int st[], int lazy[], int v) {
    st[v*2+1] += lazy[v];
    lazy[v*2+1] += lazy[v];
    st[v*2+2] += lazy[v];
    lazy[v*2+2] += lazy[v];
    lazy[v] = 0;
}

void upd(int st[], int lazy[],int v, int tl, int tr, int l, int r, int addend) {
    if (l > r)
        return;
    if (l == tl && tr == r) {
        st[v] += addend;
        lazy[v] += addend;
    } else {
        push(st,lazy,v);
        int tm = (tl + tr) / 2;
        upd(st,lazy,v*2+1, tl, tm, l, min(r, tm), addend);
        upd(st,lazy,v*2+2, tm+1, tr, max(l, tm+1), r, addend);
        st[v] = max(st[v*2+1], st[v*2+2]);
    }
}

int query(int st[], int lazy[],int v, int tl, int tr, int l, int r) {
    if (l > r)
        return -inf;
    if (l <= tl && tr <= r)
        return st[v];
    push(st,lazy,v);
    int tm = (tl + tr) / 2;
    return max(query(st,lazy,v*2+1, tl, tm, l, min(r, tm)),
               query(st,lazy,v*2+2, tm+1, tr, max(l, tm+1), r));
}

void build(ll st[], ll l, ll r, pair<ll,ll> arr1[], ll i)
{
    if(l == r)
    {
        ll maxi = inf;
        repi(j,m)
            if(arr1[j].ff>l && arr1[j].ss<maxi)
                maxi = arr1[j].ss;
        st[i] = -maxi;
        return;
    }

    ll mid = (l+r)/2;
    build(st,l,mid,arr1,2*i+1);
    build(st,mid+1,r,arr1,2*i+2);
    st[i] = max(st[2*i+1], st[2*i+2]);
}

int main()
{
   FAST/**/

   ll p;
   cin>>n>>m>>p;

   pair<ll,ll> arr[n], arr1[m];
   rep(n)
        cin>>arr[i].ff>>arr[i].ss;
   rep(m)
        cin>>arr1[i].ff>>arr1[i].ss;

   map<ll,ll> ma;
   set<ll> ste;
   rep(m)
        ste.insert(arr1[i].ff);

   pair<pair<ll,ll>,ll> hold[p];
   rep(p)
        cin>>hold[i].ff.ff>>hold[i].ff.ss>>hold[i].ss, ste.insert(hold[i].ff.ss);
   vector<ll> he;
   autoit(ste,it)
        he.pb(*it);
   ll curr = 1;
   rep(he.size())
   {
       ma[he[i]] = curr;
       curr++;
   }

   rep(m)
        arr1[i].ff = ma[arr1[i].ff];
   rep(p)
        hold[i].ff.ss = ma[hold[i].ff.ss];

   sort(hold,hold+p);
   sort(arr,arr+n);

   ll lim = ma.size();

   ll ht = ceil(log2(lim));
   ht = (1ll<<(ht + 1)) - 1;
   ll st[ht];
   ll lazy[ht];
   memset(lazy,0,sizeof(lazy));

   build(st,1,lim,arr1,0);

   ll pe = 0;

   ll ans = -inf;
   rep(n)
   {
       //vector<pair<ll,ll>> v1;
       while(pe<p && hold[pe].ff.ff<arr[i].ff)
       {
           upd(st,lazy,0,1,lim,hold[pe].ff.ss,lim,hold[pe].ss);
           //v1.pb(mp(hold[pe].ff.ss,hold[pe].ss));
           pe++;
       }

       ans = max(ans, st[0]-arr[i].ss);
   }
   cout<<ans;

   return 0;
}


#include <bits/stdc++.h>
#define FAST ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
typedef long long ll;
typedef long double ld;
#define pb push_back
#define mp make_pair
#define ff first
#define ss second
#define mod 1000000007
#define inf 1000000000000000000
#define bpc(x) __builtin_parityll(x)
#define autoit(x,it) for(auto it = x.begin(); it != x.end(); it++)
#define rep(n) for(ll i = 0; i < n; i++)
#define repi(i,n) for(ll i = 0; i < n; i++)

#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;

#define ordered_set tree<ll, null_type,less<ll>, rb_tree_tag,tree_order_statistics_node_update>

using namespace std;

ll n,m;

void upd(ll st[],ll lazy[], ll l, ll r, ll i, ll l1, ll r1, ll val)
{
    if (lazy[i] != 0)
    {
        st[i]+=lazy[i];

        if (l != r)
        {
            lazy[i*2 + 1]   += lazy[i];
            lazy[i*2 + 2]   += lazy[i];
        }

        lazy[i] = 0;
    }

    if (l>r || l>r1 || r<l1)
        return ;

    if (l>=l1 && r<=r1)
    {
        st[i]+=val;

        if (l != r)
        {
            lazy[i*2 + 1]   += val;
            lazy[i*2 + 2]   += val;
        }
        return;
    }

    ll mid = (l+r)/2;
    upd(st,lazy, l, mid, 2*i+1, l1, r1, val);
    upd(st,lazy, mid+1, r, 2*i+2, l1, r1, val);

    st[i] = max(st[2*i+1] , st[2*i+2]);

}

ll quer(ll st[],ll lazy[], ll l, ll r, ll i, ll l1, ll r1)
{
    if (lazy[i] != 0)
    {

        st[i]+=lazy[i];

        if (l != r)
        {
            lazy[i*2 + 1]   += lazy[i];
            lazy[i*2 + 2]   += lazy[i];
        }

        lazy[i] = 0;
    }

    if (l>r || l>r1 || r<l1)
        return -inf;

    if(l1<=l && r1>=r)
        return st[i];

    if(l == r)
        return st[i];

    ll mid = (l+r)/2;
    ll p1 = quer(st,lazy, l, mid,2*i+1, l1, r1);
    ll p2 = quer(st,lazy, mid+1, r,2*i+2, l1, r1);

    return max(p1,p2);
}

void build(ll st[], ll l, ll r, pair<ll,ll> arr1[], ll i)
{
    if(l == r)
    {
        ll maxi = inf;
        repi(j,m)
            if(arr1[j].ff>l && arr1[j].ss<maxi)
                maxi = arr1[j].ss;
        st[i] = -maxi;
        return;
    }

    ll mid = (l+r)/2;
    build(st,l,mid,arr1,2*i+1);
    build(st,mid+1,r,arr1,2*i+2);
    st[i] = max(st[2*i+1], st[2*i+2]);
}

int main()
{
   FAST/**/

   ll p;
   cin>>n>>m>>p;

   pair<ll,ll> arr[n], arr1[m];
   rep(n)
        cin>>arr[i].ff>>arr[i].ss;
   rep(m)
        cin>>arr1[i].ff>>arr1[i].ss;

   pair<pair<ll,ll>,ll> hold[p];
   rep(p)
        cin>>hold[i].ff.ff>>hold[i].ff.ss>>hold[i].ss;

   sort(hold,hold+p);
   sort(arr,arr+n);
   sort(arr1,arr1+m);

   ll ht = ceil(log2(1000));
   ht = (1ll<<(ht + 1)) - 1;
   ll st[ht];
   ll lazy[ht];
   memset(lazy,0,sizeof(lazy));

   build(st,1,1000,arr1,0);

   ll pe = 0;

   ll ans = -inf;
   rep(n)
   {
       vector<pair<ll,ll>> v1;
       while(pe<p && hold[pe].ff.ff<arr[i].ff)
       {
           v1.pb(mp(hold[pe].ff.ss,hold[pe].ss));
           pe++;
       }

       repi(j,v1.size())
           upd(st,lazy,1,1000,0,v1[j].ff,1000,v1[j].ss);
       ans = max(ans, st[0]-arr[i].ss);
   }
   cout<<ans;

   return 0;
}


#include <bits/stdc++.h>
#define FAST ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
typedef int ll;
typedef long double ld;
#define pb push_back
#define mp make_pair
#define ff first
#define ss second
#define mod 1000000007
#define inf 2000000005
#define bpc(x) __builtin_parityll(x)
#define autoit(x,it) for(auto it = x.begin(); it != x.end(); it++)
#define rep(n) for(ll i = 0; i < n; i++)
#define repi(i,n) for(ll i = 0; i < n; i++)

#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;

#define ordered_set tree<ll, null_type,less<ll>, rb_tree_tag,tree_order_statistics_node_update>

using namespace std;

ll n,m;

void push(int st[], int lazy[], int v) {
    st[v*2+1] += lazy[v];
    lazy[v*2+1] += lazy[v];
    st[v*2+2] += lazy[v];
    lazy[v*2+2] += lazy[v];
    lazy[v] = 0;
}

void upd(int st[], int lazy[],int v, int tl, int tr, int l, int r, int addend) {
    if (l > r)
        return;
    if (l == tl && tr == r) {
        st[v] += addend;
        lazy[v] += addend;
    } else {
        push(st,lazy,v);
        int tm = (tl + tr) / 2;
        upd(st,lazy,v*2+1, tl, tm, l, min(r, tm), addend);
        upd(st,lazy,v*2+2, tm+1, tr, max(l, tm+1), r, addend);
        st[v] = max(st[v*2+1], st[v*2+2]);
    }
}

int query(int st[], int lazy[],int v, int tl, int tr, int l, int r) {
    if (l > r)
        return -inf;
    if (l <= tl && tr <= r)
        return st[v];
    push(st,lazy,v);
    int tm = (tl + tr) / 2;
    return max(query(st,lazy,v*2+1, tl, tm, l, min(r, tm)),
               query(st,lazy,v*2+2, tm+1, tr, max(l, tm+1), r));
}

void build(ll st[], ll l, ll r, pair<ll,ll> arr1[], ll i)
{
    if(l == r)
    {
        ll maxi = inf;
        repi(j,m)
            if(arr1[j].ff>l && arr1[j].ss<maxi)
                maxi = arr1[j].ss;
        st[i] = -maxi;
        return;
    }

    ll mid = (l+r)/2;
    build(st,l,mid,arr1,2*i+1);
    build(st,mid+1,r,arr1,2*i+2);
    st[i] = max(st[2*i+1], st[2*i+2]);
}

int main()
{
   FAST/**/

   ll p;
   cin>>n>>m>>p;

   pair<ll,ll> arr[200005], arr1[200005];
   rep(n)
        cin>>arr[i].ff>>arr[i].ss;
   rep(m)
        cin>>arr1[i].ff>>arr1[i].ss;

   map<ll,ll> ma;
   set<ll> ste;
   rep(m)
        ste.insert(arr1[i].ff);

   pair<pair<ll,ll>,ll> hold[p];
   rep(p)
        cin>>hold[i].ff.ff>>hold[i].ff.ss>>hold[i].ss, ste.insert(hold[i].ff.ss);

   if(m<n)
   {
       rep(n)
            swap(arr[i], arr1[i]);
       rep(p)
            swap(hold[i].ff.ff,hold[i].ff.ss);
       swap(n,m);
   }

   vector<ll> he;
   autoit(ste,it)
        he.pb(*it);
   ll curr = 1;
   rep(he.size())
   {
       ma[he[i]] = curr;
       curr++;
   }

   rep(m)
        arr1[i].ff = ma[arr1[i].ff];
   rep(p)
        hold[i].ff.ss = ma[hold[i].ff.ss];

   sort(hold,hold+p);
   sort(arr,arr+n);

   ll lim = ma.size();

   ll ht = ceil(log2(lim));
   ht = (1ll<<(ht + 1)) - 1;
   ll st[ht];
   ll lazy[ht];
   memset(lazy,0,sizeof(lazy));

   build(st,1,lim,arr1,0);

   ll pe = 0;

   ll ans = -inf;
   rep(n)
   {
       //vector<pair<ll,ll>> v1;
       while(pe<p && hold[pe].ff.ff<arr[i].ff)
       {
           upd(st,lazy,0,1,lim,hold[pe].ff.ss,lim,hold[pe].ss);
           //v1.pb(mp(hold[pe].ff.ss,hold[pe].ss));
           pe++;
       }

       ans = max(ans, st[0]-arr[i].ss);
   }
   cout<<ans;

   return 0;
}


#include <bits/stdc++.h>
#define FAST ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
typedef int ll;
typedef long double ld;
#define pb push_back
#define mp make_pair
#define ff first
#define ss second
#define mod 1000000007
#define inf 2000000005
#define bpc(x) __builtin_parityll(x)
#define autoit(x,it) for(auto it = x.begin(); it != x.end(); it++)
#define rep(n) for(ll i = 0; i < n; i++)
#define repi(i,n) for(ll i = 0; i < n; i++)

#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;

#define ordered_set tree<ll, null_type,less<ll>, rb_tree_tag,tree_order_statistics_node_update>

using namespace std;

ll n,m;

void upd(ll st[],ll lazy[], ll l, ll r, ll i, ll l1, ll r1, ll val)
{
    if (lazy[i] != 0)
    {
        st[i]+=lazy[i];

        if (l != r)
        {
            lazy[i*2 + 1]   += lazy[i];
            lazy[i*2 + 2]   += lazy[i];
        }

        lazy[i] = 0;
    }

    if (l>r || l>r1 || r<l1)
        return ;

    if (l>=l1 && r<=r1)
    {
        st[i]+=val;

        if (l != r)
        {
            lazy[i*2 + 1]   += val;
            lazy[i*2 + 2]   += val;
        }
        return;
    }

    ll mid = (l+r)/2;
    upd(st,lazy, l, mid, 2*i+1, l1, r1, val);
    upd(st,lazy, mid+1, r, 2*i+2, l1, r1, val);

    st[i] = max(st[2*i+1] , st[2*i+2]);

}

ll quer(ll st[],ll lazy[], ll l, ll r, ll i, ll l1, ll r1)
{
    if (lazy[i] != 0)
    {

        st[i]+=lazy[i];

        if (l != r)
        {
            lazy[i*2 + 1]   += lazy[i];
            lazy[i*2 + 2]   += lazy[i];
        }

        lazy[i] = 0;
    }

    if (l>r || l>r1 || r<l1)
        return -inf;

    if(l1<=l && r1>=r)
        return st[i];

    if(l == r)
        return st[i];

    ll mid = (l+r)/2;
    ll p1 = quer(st,lazy, l, mid,2*i+1, l1, r1);
    ll p2 = quer(st,lazy, mid+1, r,2*i+2, l1, r1);

    return max(p1,p2);
}

void build(ll st[], ll l, ll r, pair<ll,ll> arr1[], ll i)
{
    if(l == r)
    {
        ll maxi = inf;
        repi(j,m)
            if(arr1[j].ff>l && arr1[j].ss<maxi)
                maxi = arr1[j].ss;
        st[i] = -maxi;
        return;
    }

    ll mid = (l+r)/2;
    build(st,l,mid,arr1,2*i+1);
    build(st,mid+1,r,arr1,2*i+2);
    st[i] = max(st[2*i+1], st[2*i+2]);
}

int main()
{
   FAST/**/

   ll p;
   cin>>n>>m>>p;

   pair<ll,ll> arr[n], arr1[m];
   rep(n)
        cin>>arr[i].ff>>arr[i].ss;
   rep(m)
        cin>>arr1[i].ff>>arr1[i].ss;

   map<ll,ll> ma;
   set<ll> ste;
   rep(m)
        ste.insert(arr1[i].ff);

   pair<pair<ll,ll>,ll> hold[p];
   rep(p)
        cin>>hold[i].ff.ff>>hold[i].ff.ss>>hold[i].ss, ste.insert(hold[i].ff.ss);
   vector<ll> he;
   autoit(ste,it)
        he.pb(*it);
   ll curr = 1;
   rep(he.size())
   {
       ma[he[i]] = curr;
       curr++;
   }

   rep(m)
        arr1[i].ff = ma[arr1[i].ff];
   rep(p)
        hold[i].ff.ss = ma[hold[i].ff.ss];

   sort(hold,hold+p);
   sort(arr,arr+n);

   ll lim = ma.size();

   ll ht = ceil(log2(lim));
   ht = (1ll<<(ht + 1)) - 1;
   ll st[ht];
   ll lazy[ht];
   memset(lazy,0,sizeof(lazy));

   build(st,1,lim,arr1,0);

   ll pe = 0;

   ll ans = -inf;
   rep(n)
   {
       vector<pair<ll,ll>> v1;
       while(pe<p && hold[pe].ff.ff<arr[i].ff)
       {
           v1.pb(mp(hold[pe].ff.ss,hold[pe].ss));
           pe++;
       }

       repi(j,v1.size())
           upd(st,lazy,1,lim,0,v1[j].ff,lim,v1[j].ss);
       ans = max(ans, st[0]-arr[i].ss);
   }
   cout<<ans;

   return 0;
}


#include <bits/stdc++.h>
#define FAST ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
typedef int ll;
typedef long double ld;
#define pb push_back
#define mp make_pair
#define ff first
#define ss second
#define mod 1000000007
#define inf 2000000005
#define bpc(x) __builtin_parityll(x)
#define autoit(x,it) for(auto it = x.begin(); it != x.end(); it++)
#define rep(n) for(ll i = 0; i < n; i++)
#define repi(i,n) for(ll i = 0; i < n; i++)

#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;

#define ordered_set tree<ll, null_type,less<ll>, rb_tree_tag,tree_order_statistics_node_update>

using namespace std;

ll n,m;

void upd(ll st[],ll lazy[], ll l, ll r, ll i, ll l1, ll r1, ll val)
{
    if (lazy[i] != 0)
    {
        st[i]+=lazy[i];

        if (l != r)
        {
            lazy[i*2 + 1]   += lazy[i];
            lazy[i*2 + 2]   += lazy[i];
        }

        lazy[i] = 0;
    }

    if (l>r || l>r1 || r<l1)
        return ;

    if (l>=l1 && r<=r1)
    {
        st[i]+=val;

        if (l != r)
        {
            lazy[i*2 + 1]   += val;
            lazy[i*2 + 2]   += val;
        }
        return;
    }

    ll mid = (l+r)/2;
    upd(st,lazy, l, mid, 2*i+1, l1, r1, val);
    upd(st,lazy, mid+1, r, 2*i+2, l1, r1, val);

    st[i] = max(st[2*i+1] , st[2*i+2]);

}

ll quer(ll st[],ll lazy[], ll l, ll r, ll i, ll l1, ll r1)
{
    if (lazy[i] != 0)
    {

        st[i]+=lazy[i];

        if (l != r)
        {
            lazy[i*2 + 1]   += lazy[i];
            lazy[i*2 + 2]   += lazy[i];
        }

        lazy[i] = 0;
    }

    if (l>r || l>r1 || r<l1)
        return -inf;

    if(l1<=l && r1>=r)
        return st[i];

    if(l == r)
        return st[i];

    ll mid = (l+r)/2;
    ll p1 = quer(st,lazy, l, mid,2*i+1, l1, r1);
    ll p2 = quer(st,lazy, mid+1, r,2*i+2, l1, r1);

    return max(p1,p2);
}

void build(ll st[], ll l, ll r, pair<ll,ll> arr1[], ll i)
{
    if(l == r)
    {
        ll maxi = inf;
        repi(j,m)
            if(arr1[j].ff>l && arr1[j].ss<maxi)
                maxi = arr1[j].ss;
        st[i] = -maxi;
        return;
    }

    ll mid = (l+r)/2;
    build(st,l,mid,arr1,2*i+1);
    build(st,mid+1,r,arr1,2*i+2);
    st[i] = max(st[2*i+1], st[2*i+2]);
}

int main()
{
   FAST/**/

   ll p;
   cin>>n>>m>>p;

   pair<ll,ll> arr[n], arr1[m];
   rep(n)
        cin>>arr[i].ff>>arr[i].ss;
   rep(m)
        cin>>arr1[i].ff>>arr1[i].ss;

   map<ll,ll> ma;
   set<ll> ste;
   rep(m)
        ste.insert(arr1[i].ff);

   pair<pair<ll,ll>,ll> hold[p];
   rep(p)
        cin>>hold[i].ff.ff>>hold[i].ff.ss>>hold[i].ss, ste.insert(hold[i].ff.ss);
   vector<ll> he;
   autoit(ste,it)
        he.pb(*it);
   ll curr = 1;
   rep(he.size())
   {
       ma[he[i]] = curr;
       curr++;
   }

   rep(m)
        arr1[i].ff = ma[arr1[i].ff];
   rep(p)
        hold[i].ff.ss = ma[hold[i].ff.ss];

   sort(hold,hold+p);
   sort(arr,arr+n);

   ll lim = ma.size();

   ll ht = ceil(log2(lim));
   ht = (1ll<<(ht + 1)) - 1;
   ll st[ht];
   ll lazy[ht];
   memset(lazy,0,sizeof(lazy));

   build(st,1,lim,arr1,0);

   ll pe = 0;

   ll ans = -inf;
   rep(n)
   {
       //vector<pair<ll,ll>> v1;
       while(pe<p && hold[pe].ff.ff<arr[i].ff)
       {
           upd(st,lazy,1,lim,0,hold[pe].ff.ss,lim,hold[pe].ss);
           //v1.pb(mp(hold[pe].ff.ss,hold[pe].ss));
           pe++;
       }

       ans = max(ans, st[0]-arr[i].ss);
   }
   cout<<ans;

   return 0;
}


#include <bits/stdc++.h>
#define FAST ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
typedef int ll;
typedef long double ld;
#define pb push_back
#define mp make_pair
#define ff first
#define ss second
#define mod 1000000007
#define inf -2000000005
#define bpc(x) __builtin_parityll(x)
#define autoit(x,it) for(auto it = x.begin(); it != x.end(); it++)
#define rep(n) for(ll i = 0; i < n; i++)
#define repi(i,n) for(ll i = 0; i < n; i++)

#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;

#define ordered_set tree<ll, null_type,less<ll>, rb_tree_tag,tree_order_statistics_node_update>

using namespace std;

ll n,m;

void upd(ll st[],ll lazy[], ll l, ll r, ll i, ll l1, ll r1, ll val)
{
    if (lazy[i] != 0)
    {
        st[i]+=lazy[i];

        if (l != r)
        {
            lazy[i*2 + 1]   += lazy[i];
            lazy[i*2 + 2]   += lazy[i];
        }

        lazy[i] = 0;
    }

    if (l>r || l>r1 || r<l1)
        return ;

    if (l>=l1 && r<=r1)
    {
        st[i]+=val;

        if (l != r)
        {
            lazy[i*2 + 1]   += val;
            lazy[i*2 + 2]   += val;
        }
        return;
    }

    ll mid = (l+r)/2;
    upd(st,lazy, l, mid, 2*i+1, l1, r1, val);
    upd(st,lazy, mid+1, r, 2*i+2, l1, r1, val);

    st[i] = max(st[2*i+1] , st[2*i+2]);

}

ll quer(ll st[],ll lazy[], ll l, ll r, ll i, ll l1, ll r1)
{
    if (lazy[i] != 0)
    {

        st[i]+=lazy[i];

        if (l != r)
        {
            lazy[i*2 + 1]   += lazy[i];
            lazy[i*2 + 2]   += lazy[i];
        }

        lazy[i] = 0;
    }

    if (l>r || l>r1 || r<l1)
        return -inf;

    if(l1<=l && r1>=r)
        return st[i];

    if(l == r)
        return st[i];

    ll mid = (l+r)/2;
    ll p1 = quer(st,lazy, l, mid,2*i+1, l1, r1);
    ll p2 = quer(st,lazy, mid+1, r,2*i+2, l1, r1);

    return max(p1,p2);
}

void build(ll st[], ll l, ll r, pair<ll,ll> arr1[], ll i)
{
    if(l == r)
    {
        ll maxi = inf;
        repi(j,m)
            if(arr1[j].ff>l && arr1[j].ss<maxi)
                maxi = arr1[j].ss;
        st[i] = -maxi;
        return;
    }

    ll mid = (l+r)/2;
    build(st,l,mid,arr1,2*i+1);
    build(st,mid+1,r,arr1,2*i+2);
    st[i] = max(st[2*i+1], st[2*i+2]);
}

int main()
{
   FAST/**/

   ll p;
   cin>>n>>m>>p;

   pair<ll,ll> arr[n], arr1[m];
   rep(n)
        cin>>arr[i].ff>>arr[i].ss;
   rep(m)
        cin>>arr1[i].ff>>arr1[i].ss;

   map<ll,ll> ma;
   set<ll> ste;
   rep(m)
        ste.insert(arr1[i].ff);

   pair<pair<ll,ll>,ll> hold[p];
   rep(p)
        cin>>hold[i].ff.ff>>hold[i].ff.ss>>hold[i].ss, ste.insert(hold[i].ff.ss);
   vector<ll> he;
   autoit(ste,it)
        he.pb(*it);
   ll curr = 1;
   rep(he.size())
   {
       ma[he[i]] = curr;
       curr++;
   }

   rep(m)
        arr1[i].ff = ma[arr1[i].ff];
   rep(p)
        hold[i].ff.ss = ma[hold[i].ff.ss];

   sort(hold,hold+p);
   sort(arr,arr+n);

   ll lim = ma.size();

   ll ht = ceil(log2(lim));
   ht = (1ll<<(ht + 1)) - 1;
   ll st[ht];
   ll lazy[ht];
   memset(lazy,0,sizeof(lazy));

   build(st,1,lim,arr1,0);

   ll pe = 0;

   ll ans = -inf;
   rep(n)
   {
       vector<pair<ll,ll>> v1;
       while(pe<p && hold[pe].ff.ff<arr[i].ff)
       {
           v1.pb(mp(hold[pe].ff.ss,hold[pe].ss));
           pe++;
       }

       repi(j,v1.size())
           upd(st,lazy,1,lim,0,v1[j].ff,lim,v1[j].ss);
       ans = max(ans, st[0]-arr[i].ss);
   }
   cout<<ans;

   return 0;
}


#include <bits/stdc++.h>
#define FAST ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
typedef long long ll;
typedef long double ld;
#define pb push_back
#define mp make_pair
#define ff first
#define ss second
#define mod 1000000007
#define inf 1000000000000000000
#define bpc(x) __builtin_parityll(x)
#define autoit(x,it) for(auto it = x.begin(); it != x.end(); it++)
#define rep(n) for(ll i = 0; i < n; i++)
#define repi(i,n) for(ll i = 0; i < n; i++)

#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;

#define ordered_set tree<ll, null_type,less<ll>, rb_tree_tag,tree_order_statistics_node_update>

using namespace std;

ll n,m;

void upd(ll st[],ll lazy[], ll l, ll r, ll i, ll l1, ll r1, ll val)
{
    if (lazy[i] != 0)
    {
        st[i]+=lazy[i];

        if (l != r)
        {
            lazy[i*2 + 1]   += lazy[i];
            lazy[i*2 + 2]   += lazy[i];
        }

        lazy[i] = 0;
    }

    if (l>r || l>r1 || r<l1)
        return ;

    if (l>=l1 && r<=r1)
    {
        st[i]+=val;

        if (l != r)
        {
            lazy[i*2 + 1]   += val;
            lazy[i*2 + 2]   += val;
        }
        return;
    }

    ll mid = (l+r)/2;
    upd(st,lazy, l, mid, 2*i+1, l1, r1, val);
    upd(st,lazy, mid+1, r, 2*i+2, l1, r1, val);

    st[i] = max(st[2*i+1] , st[2*i+2]);

}

ll quer(ll st[],ll lazy[], ll l, ll r, ll i, ll l1, ll r1)
{
    if (lazy[i] != 0)
    {

        st[i]+=lazy[i];

        if (l != r)
        {
            lazy[i*2 + 1]   += lazy[i];
            lazy[i*2 + 2]   += lazy[i];
        }

        lazy[i] = 0;
    }

    if (l>r || l>r1 || r<l1)
        return -inf;

    if(l1<=l && r1>=r)
        return st[i];

    if(l == r)
        return st[i];

    ll mid = (l+r)/2;
    ll p1 = quer(st,lazy, l, mid,2*i+1, l1, r1);
    ll p2 = quer(st,lazy, mid+1, r,2*i+2, l1, r1);

    return max(p1,p2);
}

void build(ll st[], ll l, ll r, pair<ll,ll> arr1[], ll i)
{
    if(l == r)
    {
        ll maxi = inf;
        repi(j,m)
            if(arr1[j].ff>l && arr1[j].ss<maxi)
                maxi = arr1[j].ss;
        st[i] = -maxi;
        return;
    }

    ll mid = (l+r)/2;
    build(st,l,mid,arr1,2*i+1);
    build(st,mid+1,r,arr1,2*i+2);
    st[i] = max(st[2*i+1], st[2*i+2]);
}

int main()
{
   FAST/**/

   ll p;
   cin>>n>>m>>p;

   pair<ll,ll> arr[n], arr1[m];
   rep(n)
        cin>>arr[i].ff>>arr[i].ss;
   rep(m)
        cin>>arr1[i].ff>>arr1[i].ss;

   pair<pair<ll,ll>,ll> hold[p];
   rep(p)
        cin>>hold[i].ff.ff>>hold[i].ff.ss>>hold[i].ss;

   sort(hold,hold+p);
   sort(arr,arr+n);
   sort(arr1,arr1+m);

   ll ht = ceil(log2(10005));
   ht = (1ll<<(ht + 1)) - 1;
   ll st[ht];
   ll lazy[ht];
   memset(lazy,0,sizeof(lazy));

   build(st,1,10005,arr1,0);

   ll pe = 0;

   ll ans = -inf;
   rep(n)
   {
       vector<pair<ll,ll>> v1;
       while(pe<p && hold[pe].ff.ff<arr[i].ff)
       {
           v1.pb(mp(hold[pe].ff.ss,hold[pe].ss));
           pe++;
       }

       repi(j,v1.size())
           upd(st,lazy,1,10005,0,v1[j].ff,10005,v1[j].ss);
       ans = max(ans, st[0]-arr[i].ss);
   }
   cout<<ans;

   return 0;
}


#include <bits/stdc++.h>
#define FAST ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
typedef long long ll;
typedef long double ld;
#define pb push_back
#define mp make_pair
#define ff first
#define ss second
#define mod 1000000007
#define inf 1000000000000000000
#define bpc(x) __builtin_parityll(x)
#define autoit(x,it) for(auto it = x.begin(); it != x.end(); it++)
#define rep(n) for(ll i = 0; i < n; i++)
#define repi(i,n) for(ll i = 0; i < n; i++)

#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;

#define ordered_set tree<ll, null_type,less<ll>, rb_tree_tag,tree_order_statistics_node_update>

using namespace std;

ll n,m;
ll cosi = inf;
ll ptr;

void upd(ll st[],ll lazy[], ll l, ll r, ll i, ll l1, ll r1, ll val)
{
    if (lazy[i] != 0)
    {
        st[i]+=lazy[i];

        if (l != r)
        {
            lazy[i*2 + 1]   += lazy[i];
            lazy[i*2 + 2]   += lazy[i];
        }

        lazy[i] = 0;
    }

    if (l>r || l>r1 || r<l1)
        return ;

    if (l>=l1 && r<=r1)
    {
        st[i]+=val;

        if (l != r)
        {
            lazy[i*2 + 1]   += val;
            lazy[i*2 + 2]   += val;
        }
        return;
    }

    ll mid = (l+r)/2;
    upd(st,lazy, l, mid, 2*i+1, l1, r1, val);
    upd(st,lazy, mid+1, r, 2*i+2, l1, r1, val);

    st[i] = max(st[2*i+1] , st[2*i+2]);

}

ll quer(ll st[],ll lazy[], ll l, ll r, ll i, ll l1, ll r1)
{
    if (lazy[i] != 0)
    {

        st[i]+=lazy[i];

        if (l != r)
        {
            lazy[i*2 + 1]   += lazy[i];
            lazy[i*2 + 2]   += lazy[i];
        }

        lazy[i] = 0;
    }

    if (l>r || l>r1 || r<l1)
        return -inf;

    if(l1<=l && r1>=r)
        return st[i];

    if(l == r)
        return st[i];

    ll mid = (l+r)/2;
    ll p1 = quer(st,lazy, l, mid,2*i+1, l1, r1);
    ll p2 = quer(st,lazy, mid+1, r,2*i+2, l1, r1);

    return max(p1,p2);
}

void build(ll st[], ll l, ll r, pair<ll,ll> arr1[], ll i)
{
    if(l == r)
    {
        ll maxi = inf;
        while(ptr>-1 && arr1[ptr].ff>l)
        {
            cosi = min(cosi,arr1[ptr].ss);
            ptr--;
        }
        st[i] = -cosi;
        /*if(cosi!=inf)
            cout<<"at "<<l<<" = "<<cosi<<'\n';*/
        return;
    }

    ll mid = (l+r)/2;
    build(st,mid+1,r,arr1,2*i+2);
    build(st,l,mid,arr1,2*i+1);
    st[i] = max(st[2*i+1], st[2*i+2]);
}

int main()
{
   FAST/**/

   ll p;
   cin>>n>>m>>p;
   ptr = m-1;
   pair<ll,ll> arr[n], arr1[m];
   rep(n)
        cin>>arr[i].ff>>arr[i].ss;
   rep(m)
        cin>>arr1[i].ff>>arr1[i].ss;

   pair<pair<ll,ll>,ll> hold[p];
   rep(p)
        cin>>hold[i].ff.ff>>hold[i].ff.ss>>hold[i].ss;

   sort(hold,hold+p);
   sort(arr,arr+n);
   sort(arr1,arr1+m);

   ll ht = ceil(log2(1000005));
   ht = (1ll<<(ht + 1)) - 1;
   ll st[ht];
   ll lazy[ht];
   memset(lazy,0,sizeof(lazy));

   build(st,0,1000004,arr1,0);

   ll pe = 0;

   ll ans = -inf;
   rep(n)
   {
       vector<pair<ll,ll>> v1;
       while(pe<p && hold[pe].ff.ff<arr[i].ff)
       {
           v1.pb(mp(hold[pe].ff.ss,hold[pe].ss));
           pe++;
       }

       repi(j,v1.size())
           upd(st,lazy,0,1000004,0,v1[j].ff,1000004,v1[j].ss);
       ans = max(ans, st[0]-arr[i].ss);
   }
   cout<<ans;

   return 0;
}


#include <bits/stdc++.h>
#define FAST ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
typedef long long ll;
typedef long double ld;
#define pb push_back
#define mp make_pair
#define ff first
#define ss second
#define mod 1000000007
#define inf 1000000000000000000
#define bpc(x) __builtin_parityll(x)
#define autoit(x,it) for(auto it = x.begin(); it != x.end(); it++)
#define rep(n) for(ll i = 0; i < n; i++)
#define repi(i,n) for(ll i = 0; i < n; i++)

#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;

#define ordered_set tree<ll, null_type,less<ll>, rb_tree_tag,tree_order_statistics_node_update>

using namespace std;

ll n,m;
ll cosi = inf;
ll ptr;

void upd(ll st[],ll lazy[], ll l, ll r, ll i, ll l1, ll r1, ll val)
{
    if (lazy[i] != 0)
    {
        st[i]+=lazy[i];

        if (l != r)
        {
            lazy[i*2 + 1]   += lazy[i];
            lazy[i*2 + 2]   += lazy[i];
        }

        lazy[i] = 0;
    }

    if (l>r || l>r1 || r<l1)
        return ;

    if (l>=l1 && r<=r1)
    {
        st[i]+=val;

        if (l != r)
        {
            lazy[i*2 + 1]   += val;
            lazy[i*2 + 2]   += val;
        }
        return;
    }

    ll mid = (l+r)/2;
    upd(st,lazy, l, mid, 2*i+1, l1, r1, val);
    upd(st,lazy, mid+1, r, 2*i+2, l1, r1, val);

    st[i] = max(st[2*i+1] , st[2*i+2]);

}

ll quer(ll st[],ll lazy[], ll l, ll r, ll i, ll l1, ll r1)
{
    if (lazy[i] != 0)
    {

        st[i]+=lazy[i];

        if (l != r)
        {
            lazy[i*2 + 1]   += lazy[i];
            lazy[i*2 + 2]   += lazy[i];
        }

        lazy[i] = 0;
    }

    if (l>r || l>r1 || r<l1)
        return -inf;

    if(l1<=l && r1>=r)
        return st[i];

    if(l == r)
        return st[i];

    ll mid = (l+r)/2;
    ll p1 = quer(st,lazy, l, mid,2*i+1, l1, r1);
    ll p2 = quer(st,lazy, mid+1, r,2*i+2, l1, r1);

    return max(p1,p2);
}

void build(ll st[], ll l, ll r, pair<ll,ll> arr1[], ll i)
{
    if(l == r)
    {
        ll maxi = inf;
        while(ptr>-1 && arr1[ptr].ff>l)
        {
            cosi = min(cosi,arr1[ptr].ss);
            ptr--;
        }
        st[i] = -cosi;
        return;
    }

    ll mid = (l+r)/2;
    build(st,mid+1,r,arr1,2*i+2);
    build(st,l,mid,arr1,2*i+1);
    st[i] = max(st[2*i+1], st[2*i+2]);
}

int main()
{
   FAST/**/

   ll p;
   cin>>n>>m>>p;
   ptr = m-1;
   pair<ll,ll> arr[n], arr1[m];
   rep(n)
        cin>>arr[i].ff>>arr[i].ss;
   rep(m)
        cin>>arr1[i].ff>>arr1[i].ss;

   pair<pair<ll,ll>,ll> hold[p];
   rep(p)
        cin>>hold[i].ff.ff>>hold[i].ff.ss>>hold[i].ss;

   sort(hold,hold+p);
   sort(arr,arr+n);
   sort(arr1,arr1+m);

   ll ht = ceil(log2(1000005));
   ht = (1ll<<(ht + 1)) - 1;
   ll st[ht];
   ll lazy[ht];
   memset(lazy,0,sizeof(lazy));

   build(st,1,1000005,arr1,0);

   ll pe = 0;

   ll ans = -inf;
   rep(n)
   {
       vector<pair<ll,ll>> v1;
       while(pe<p && hold[pe].ff.ff<arr[i].ff)
       {
           v1.pb(mp(hold[pe].ff.ss,hold[pe].ss));
           pe++;
       }

       repi(j,v1.size())
           upd(st,lazy,1,1000005,0,v1[j].ff,1000005,v1[j].ss);
       ans = max(ans, st[0]-arr[i].ss);
   }
   cout<<ans;

   return 0;
}


#include <bits/stdc++.h>
#define FAST ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
typedef long long ll;
typedef long double ld;
#define pb push_back
#define mp make_pair
#define ff first
#define ss second
#define mod 1000000007
#define inf 1000000000000000000
#define bpc(x) __builtin_parityll(x)
#define autoit(x,it) for(auto it = x.begin(); it != x.end(); it++)
#define rep(n) for(ll i = 0; i < n; i++)
#define repi(i,n) for(ll i = 0; i < n; i++)

#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;

#define ordered_set tree<ll, null_type,less<ll>, rb_tree_tag,tree_order_statistics_node_update>

using namespace std;

ll n,m;
ll cosi = inf;
ll ptr;

void upd(ll st[],ll lazy[], ll l, ll r, ll i, ll l1, ll r1, ll val)
{
    if (lazy[i] != 0)
    {
        st[i]+=lazy[i];

        if (l != r)
        {
            lazy[i*2 + 1]   += lazy[i];
            lazy[i*2 + 2]   += lazy[i];
        }

        lazy[i] = 0;
    }

    if (l>r || l>r1 || r<l1)
        return ;

    if (l>=l1 && r<=r1)
    {
        st[i]+=val;

        if (l != r)
        {
            lazy[i*2 + 1]   += val;
            lazy[i*2 + 2]   += val;
        }
        return;
    }

    ll mid = (l+r)/2;
    upd(st,lazy, l, mid, 2*i+1, l1, r1, val);
    upd(st,lazy, mid+1, r, 2*i+2, l1, r1, val);

    st[i] = max(st[2*i+1] , st[2*i+2]);

}

ll quer(ll st[],ll lazy[], ll l, ll r, ll i, ll l1, ll r1)
{
    if (lazy[i] != 0)
    {

        st[i]+=lazy[i];

        if (l != r)
        {
            lazy[i*2 + 1]   += lazy[i];
            lazy[i*2 + 2]   += lazy[i];
        }

        lazy[i] = 0;
    }

    if (l>r || l>r1 || r<l1)
        return -inf;

    if(l1<=l && r1>=r)
        return st[i];

    if(l == r)
        return st[i];

    ll mid = (l+r)/2;
    ll p1 = quer(st,lazy, l, mid,2*i+1, l1, r1);
    ll p2 = quer(st,lazy, mid+1, r,2*i+2, l1, r1);

    return max(p1,p2);
}

void build(ll st[], ll l, ll r, pair<ll,ll> arr1[], ll i)
{
    if(l == r)
    {
        ll maxi = inf;
        while(ptr>-1 && arr1[ptr].ff>l)
        {
            cosi = min(cosi,arr1[ptr].ss);
            ptr--;
        }
        st[i] = -cosi;
        return;
    }

    ll mid = (l+r)/2;
    build(st,mid+1,r,arr1,2*i+2);
    build(st,l,mid,arr1,2*i+1);
    st[i] = max(st[2*i+1], st[2*i+2]);
}

int main()
{
   FAST/**/

   ll p;
   cin>>n>>m>>p;
   ptr = m-1;
   pair<ll,ll> arr[n], arr1[m];
   rep(n)
        cin>>arr[i].ff>>arr[i].ss;
   rep(m)
        cin>>arr1[i].ff>>arr1[i].ss;

   pair<pair<ll,ll>,ll> hold[p];
   rep(p)
        cin>>hold[i].ff.ff>>hold[i].ff.ss>>hold[i].ss;

   sort(hold,hold+p);
   sort(arr,arr+n);
   sort(arr1,arr1+m);

   ll ht = ceil(log2(1000005));
   ht = (1ll<<(ht + 1)) - 1;
   ll st[ht];
   ll lazy[ht];
   memset(lazy,0,sizeof(lazy));

   build(st,1,1000005,arr1,0);

   ll pe = 0;

   ll ans = st[0];
   rep(n)
   {
       vector<pair<ll,ll>> v1;
       while(pe<p && hold[pe].ff.ff<arr[i].ff)
       {
           v1.pb(mp(hold[pe].ff.ss,hold[pe].ss));
           pe++;
       }

       repi(j,v1.size())
           upd(st,lazy,1,1000005,0,v1[j].ff,1000005,v1[j].ss);
       ans = max(ans, st[0]-arr[i].ss);
   }
   cout<<ans;

   return 0;
}


#include "bits/stdc++.h"
using namespace std;

// M A F I A - M A F I A - M A F I A - M A F I A - M A F I A - M A F I A //

#define int                                       long long
#define lop(i,s,e)                                for(int i=s;i<(int)e;i++)
#define rlop(i,e,s)                               for(int i=e;i>=s;i--)
#define prvec(v)                                  lop(R15,0,v.size())cout << v[R15] <<" "; cout << endl;
#define prarr(arr,s1,e1)                          lop(R15,s1,e1)cout << arr[R15] << " "; cout << endl;

#define endl                                      '\n'
#define ff                                        first
#define ss                                        second
#define pii                                       pair<int,int>

#define pb                                        push_back
#define all(v)                                    v.begin(),v.end()

#define bug(...)                                  __f (#__VA_ARGS__, __VA_ARGS__)
#define rtn                                       if(0)return;
template <typename Arg1>
void __f (const char* name, Arg1&& arg1) { rtn cout << name << " : " << arg1 << endl; }
template <typename Arg1, typename... Args>
void __f (const char* names, Arg1&& arg1, Args&&... args)
{     rtn
     const char* comma = strchr (names + 1, ',');
     cout.write (names, comma - names) << " : " << arg1 << " | "; __f (comma + 1, args...);
}

// M A F I A - M A F I A - M A F I A - M A F I A - M A F I A - M A F I A //

inline void INP();
const int N = 1e6 + 7, M = 1000000007, inf = INT_MAX;
const long long INF = LLONG_MAX;

int segt[4*N], lazy[4*N];
int mxd, mxa;

void push(int i)
{
      segt[2*i+1] += lazy[i];
      segt[2*i+2] += lazy[i];

      lazy[2*i+1] += lazy[i];
      lazy[2*i+2] += lazy[i];

      lazy[i] = 0;
}

void get(int i)
{
      segt[i] = max(segt[2*i+1], segt[2*i+2]);
}

void update(int l, int r, int L, int R, int i, int val)
{
      if( l > R  or L > r ) return ;
      if( L <= l and r <= R )
      {
            segt[i] += val;
            lazy[i] += val;
            // bug(l,r,L, R, segt[i], lazy[i], val);
            return;
      }

      if(lazy[i]) push(i);

      int mid = (l+r)/2;
      update(l,   mid, L, R, 2*i+1, val);
      update(mid+1, r, L, R, 2*i+2, val);

      get(i);
}

int query(int l, int r, int L, int R, int i)
{

      if( l > R  or L > r )   return -inf;
      if( L <= l and r <= R ) return segt[i];

      if(lazy[i]) push(i);

      int mid = (l+r)/2;
      int a = query(l,   mid, L, R, 2*i+1);
      int b = query(mid+1, r, L, R, 2*i+2);

      get(i);

      return max(a, b);
}

void upd(int L, int R, int val)
{
      update(0, mxd, L, R, 0, val);
}

int qry(int L, int R)
{
      return query(0, mxd, L, R, 0);
}

struct monster
{
      int at, df, coins;
};

void solve()
{
      int n, m, p;
      cin >> n >> m >> p;
      vector< pii > attack(n), defence(m);
      vector< monster > mons;

      mxa = -1, mxd  =-1;
      lop(i,0,n) cin >> attack[i].ff >> attack[i].ss, mxa   = max(mxa, attack[i].ff);
      lop(i,0,m) cin >> defence[i].ff >> defence[i].ss, mxd = max(mxd, defence[i].ff);
      int cnt = 0;
      lop(i,0,p)
      {
            int df, at, c;
            cin >> df >> at >> c;
            swap(df, at);
            if( 1 )
            {
                  cnt++;
                  monster r = { at, df, c};
                  mons.pb(r);
            }
      }
      p = cnt;

      sort( all(attack), [&](pii &p1, pii &p2)
      {
            return p1.ss < p2.ss;
      });

      sort( all(defence), [&](pii &p1, pii &p2)
      {
            return p1.ss < p2.ss;
      });

      sort( all(mons), [&](monster &p1, monster &p2)
      {
            return p1.at < p2.at;
      });

      vector<pii> temp;

      int mx = -1;
      lop(i,0,n)
      {
            if( attack[i].ff > mx )
            {
                  mx = max(mx, attack[i].ff);
                  temp.pb(attack[i]);
            }
      }

      attack = temp;
      temp.clear();

      mx = -1;
      lop(i,0,m)
      {
            if( defence[i].ff > mx )
            {
                  mx = max(mx, defence[i].ff);
                  temp.pb(defence[i]);
            }
      }
      defence = temp;
      temp.clear();

      n = attack.size(), m = defence.size();
      int prev = 0;

      for(int i=0; i<m; i++)
      {
            upd(prev, defence[i].ff, -defence[i].ss);
            prev = defence[i].ff + 1;
      }

      int ans = -inf;

      int j = 0;
      lop(i,0,n)
      {
            int  at = attack[i].ff;
            while( j < p and mons[j].at < at )
            {
                  int df = mons[j].df;
                  upd(df+1, mxd, mons[j].coins);
                  j++;
            }
            int pr = qry(0, mxd) - attack[i].ss;
            ans = max(ans, pr);
      }

      cout << ans;

}

int32_t main()
{

      ios_base::sync_with_stdio(0);   cin.tie(0);   cout.tie(0);
      INP();
      int t = 1;
      //cin >> t;
      while(t--) solve();

}

inline void INP()
{
      #ifndef ONLINE_JUDGE
          freopen("input.txt",  "r",  stdin);
          freopen("output.txt", "w", stdout);
      #endif
}

// M A F I A - M A F I A - M A F I A - M A F I A - M A F I A - M A F I A //


#include "bits/stdc++.h"
using namespace std;

// M A F I A - M A F I A - M A F I A - M A F I A - M A F I A - M A F I A //

#define lop(i,s,e)                                for(int i=s;i<(int)e;i++)
#define rlop(i,e,s)                               for(int i=e;i>=s;i--)
#define prvec(v)                                  lop(R15,0,v.size())cout << v[R15] <<" "; cout << endl;
#define prarr(arr,s1,e1)                          lop(R15,s1,e1)cout << arr[R15] << " "; cout << endl;

#define endl                                      '\n'
#define ff                                        first
#define ss                                        second
#define pii                                       pair<int,int>

#define pb                                        push_back
#define all(v)                                    v.begin(),v.end()

#define bug(...)                                  __f (#__VA_ARGS__, __VA_ARGS__)
#define rtn                                       if(0)return;
template <typename Arg1>
void __f (const char* name, Arg1&& arg1) { rtn cout << name << " : " << arg1 << endl; }
template <typename Arg1, typename... Args>
void __f (const char* names, Arg1&& arg1, Args&&... args)
{     rtn
      const char* comma = strchr (names + 1, ',');
      cout.write (names, comma - names) << " : " << arg1 << " | "; __f (comma + 1, args...);
}

// M A F I A - M A F I A - M A F I A - M A F I A - M A F I A - M A F I A //

inline void INP();
const int N = 3e6 + 7, M = 1000000007, inf = INT_MAX;
const long long INF = LLONG_MAX;

// Segment Tree

template <typename T>
class segment_tree{
public:
// for '0' index  queries
      int sz; vector<T> segt; vector<int> lazy;
      T ff(T a,T b)
      {
          return max(a,b);         //  function{min, max, sum ,gcd ,or ,and}
      }

      void push(int i, int l, int r)
      {
            segt[i] += lazy[i];   // change here also
            if( l != r ){  lazy[2*i+1] += lazy[i]; lazy[2*i+2] += lazy[i]; } lazy[i] = 0;
      }

      T queryUtil(int l, int r, int i, int L, int R)
      {
            if(lazy[i]) push(i,l,r);
            if( r  < L or R < l )   return -inf;     // unwanted value

            if( L <= l and r <= R)   return segt[i];
            int mid = l + (r-l)/2, a = queryUtil(l, mid, 2*i + 1, L, R), b = queryUtil(mid+1, r  , 2*i + 2, L, R);
            get(i); return ff(a,b);
      }

      void updateUtil( int l, int r, int i, int L, int R,  int val)
      {
            if(lazy[i]) push(i, l, r); if( l > R or L > r ) return ;
            if( L <= l and r <= R )
            {
                  lazy[i] += val; // change here
                  push(i,l,r);  return;
            }
            int mid = l + (r-l)/2;updateUtil(l, mid, i*2 + 1,L,R,val); updateUtil(mid+1, r, i*2 + 2, L,R,val); get(i);
      }

      void init(int x) {  sz = x; segt.resize(4*sz); lazy.assign(4*sz, 0); }
      T query(int L, int R = -1) { if(R ==-1) R= L; return queryUtil(0, sz-1, 0, L, R); }
      void update(int val, int L, int R = -1){ if( R == -1 ) R = L; updateUtil(0, sz-1, 0, L,R, val); }
      void get(int i){ segt[i] = ff(segt[2*i+1], segt[2*i+2]); }

};

struct monster
{
      int at, df, coins;
};

int mxa, mxd;

void solve()
{
      int n, m, p;
      cin >> n >> m >> p;
      vector< pii > attack(n), defence(m);
      vector< monster > mons;

      mxa = -1, mxd  =-1;
      lop(i,0,n) cin >> attack[i].ff >> attack[i].ss, mxa   = max(mxa, attack[i].ff);
      lop(i,0,m) cin >> defence[i].ff >> defence[i].ss, mxd = max(mxd, defence[i].ff);
      int cnt = 0;
      lop(i,0,p)
      {
            int df, at, c;
            cin >> at >> df >> c;
            swap(at, df);
            monster r = { df, at, c};
            mons.pb(r);
      }

      sort( all(attack), [&](pii &p1, pii &p2)
      {
            return p1.ss < p2.ss;
      });

      sort( all(defence), [&](pii &p1, pii &p2)
      {
            return p1.ss < p2.ss;
      });

      sort( all(mons), [&](monster &p1, monster &p2)
      {
            return p1.at < p2.at;
      });

      vector<pii> temp;

      int mx = -1;
      lop(i,0,n)
      {
            if( attack[i].ff > mx )
            {
                  mx = max(mx, attack[i].ff);
                  temp.pb(attack[i]);
            }
      }

      attack = temp;
      temp.clear();

      mx = -1;
      lop(i,0,m)
      {
            if( defence[i].ff > mx )
            {
                  mx = max(mx, defence[i].ff);
                  temp.pb(defence[i]);
            }
      }
      defence = temp;
      temp.clear();

      n = attack.size(), m = defence.size();
      int prev = 0;
      segment_tree<int> sgt;
      sgt.init(mxd+2);

      lop(i,0,m)
      {
            sgt.update(-defence[i].ss, prev, defence[i].ff);
            prev = defence[i].ff + 1;
      }

      int j = 0, ans = -inf;
      lop(i,0,n)
      {
            while( j < p and mons[j].at < attack[i].ff )
            {
                  sgt.update(mons[j].coins, mons[j].df+1, mxd);
                  j++;
            }

            int profit = sgt.query(0, mxd) - attack[i].ss;
            ans = max(ans, profit);
      }

      cout << ans << endl;

}

int32_t main()
{

      ios_base::sync_with_stdio(0);   cin.tie(0);   cout.tie(0);
      INP();
      int t = 1;
//cin >> t;
      while(t--) solve();

}

inline void INP()
{
#ifndef ONLINE_JUDGE
  freopen("input.txt",  "r",  stdin);
  freopen("output.txt", "w", stdout);
#endif
}

// M A F I A - M A F I A - M A F I A - M A F I A - M A F I A - M A F I A //


#include "bits/stdc++.h"
using namespace std;

// M A F I A - M A F I A - M A F I A - M A F I A - M A F I A - M A F I A //

#define int                                       long long
#define lop(i,s,e)                                for(int i=s;i<(int)e;i++)
#define rlop(i,e,s)                               for(int i=e;i>=s;i--)
#define prvec(v)                                  lop(R15,0,v.size())cout << v[R15] <<" "; cout << endl;
#define prarr(arr,s1,e1)                          lop(R15,s1,e1)cout << arr[R15] << " "; cout << endl;

#define endl                                      '\n'
#define ff                                        first
#define ss                                        second
#define pii                                       pair<int,int>

#define pb                                        push_back
#define all(v)                                    v.begin(),v.end()

#define bug(...)                                  __f (#__VA_ARGS__, __VA_ARGS__)
#define rtn                                       if(0)return;
template <typename Arg1>
void __f (const char* name, Arg1&& arg1) { rtn cout << name << " : " << arg1 << endl; }
template <typename Arg1, typename... Args>
void __f (const char* names, Arg1&& arg1, Args&&... args)
{     rtn
     const char* comma = strchr (names + 1, ',');
     cout.write (names, comma - names) << " : " << arg1 << " | "; __f (comma + 1, args...);
}

// M A F I A - M A F I A - M A F I A - M A F I A - M A F I A - M A F I A //

inline void INP();
const int N = 1e6 + 7, M = 1000000007, inf = INT_MAX;
const long long INF = LLONG_MAX;

int segt[4*N], lazy[4*N];
int mxd, mxa;

void push(int i)
{
      segt[2*i+1] += lazy[i];
      segt[2*i+2] += lazy[i];

      lazy[2*i+1] += lazy[i];
      lazy[2*i+2] += lazy[i];

      lazy[i] = 0;
}

void get(int i)
{
      segt[i] = max(segt[2*i+1], segt[2*i+2]);
}

void update(int l, int r, int L, int R, int i, int val)
{
      if( l > R  or L > r ) return ;
      if( L <= l and r <= R )
      {
            segt[i] += val;
            lazy[i] += val;
            // bug(l,r,L, R, segt[i], lazy[i], val);
            return;
      }

      if(lazy[i]) push(i);

      int mid = (l+r)/2;
      update(l,   mid, L, R, 2*i+1, val);
      update(mid+1, r, L, R, 2*i+2, val);

      get(i);
}

int query(int l, int r, int L, int R, int i)
{

      if( l > R  or L > r )   return -inf;
      if( L <= l and r <= R ) return segt[i];

      if(lazy[i]) push(i);

      int mid = (l+r)/2;
      int a = query(l,   mid, L, R, 2*i+1);
      int b = query(mid+1, r, L, R, 2*i+2);

      get(i);

      return max(a, b);
}

void upd(int L, int R, int val)
{
      update(0, mxd, L, R, 0, val);
}

int qry(int L, int R)
{
      return query(0, mxd, L, R, 0);
}

struct monster
{
      int at, df, coins;
};

void solve()
{
      int n, m, p;
      cin >> n >> m >> p;
      vector< pii > attack(n), defence(m);
      vector< monster > mons;

      mxa = -1, mxd  =-1;
      lop(i,0,n) cin >> attack[i].ff >> attack[i].ss, mxa   = max(mxa, attack[i].ff);
      lop(i,0,m) cin >> defence[i].ff >> defence[i].ss, mxd = max(mxd, defence[i].ff);
      int cnt = 0;
      lop(i,0,p)
      {
            int df, at, c;
            cin >> df >> at >> c;
            if( at < mxa and df < mxd )
            {
                  cnt++;
                  monster r = { at, df, c};
                  mons.pb(r);
            }
      }
      p = cnt;

      sort( all(attack), [&](pii &p1, pii &p2)
      {
            return p1.ss < p2.ss;
      });

      sort( all(defence), [&](pii &p1, pii &p2)
      {
            return p1.ss < p2.ss;
      });

      sort( all(mons), [&](monster &p1, monster &p2)
      {
            return p1.at < p2.at;
      });

      vector<pii> temp;

      int mx = -1;
      lop(i,0,n)
      {
            if( attack[i].ff > mx )
            {
                  mx = max(mx, attack[i].ff);
                  temp.pb(attack[i]);
            }
      }

      attack = temp;
      temp.clear();

      mx = -1;
      lop(i,0,m)
      {
            if( defence[i].ff > mx )
            {
                  mx = max(mx, defence[i].ff);
                  temp.pb(defence[i]);
            }
      }
      defence = temp;
      temp.clear();

      n = attack.size(), m = defence.size();
      int prev = 0;

      for(int i=0; i<m; i++)
      {
            upd(prev, defence[i].ff, -defence[i].ss);
            prev = defence[i].ff + 1;
      }

      int ans = -inf;

      int j = 0;
      lop(i,0,n)
      {
            int  at = attack[i].ff;
            while( j < p and mons[j].at < at )
            {
                  int df = mons[j].df;
                  upd(df+1, mxd, mons[j].coins);
                  j++;
            }
            int pr = qry(0, mxd) - attack[i].ss;
            ans = max(ans, pr);
      }

      cout << ans;

}

int32_t main()
{

      ios_base::sync_with_stdio(0);   cin.tie(0);   cout.tie(0);
      INP();
      int t = 1;
      //cin >> t;
      while(t--) solve();

}

inline void INP()
{
      #ifndef ONLINE_JUDGE
          freopen("input.txt",  "r",  stdin);
          freopen("output.txt", "w", stdout);
      #endif
}

// M A F I A - M A F I A - M A F I A - M A F I A - M A F I A - M A F I A //