#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const long long MAXN = 100100;
long long work[MAXN];
long long pwork[MAXN];
vector<long long> make(vector<long long> l, vector<long long> u,
                       long long total) {
  assert(l.size() == u.size());
  long long ls = 0;
  long long us = 0;
  for (long long a : l) ls += a;
  for (long long a : u) us += a;
  if (total < ls || total > us) return {};
  for (long long i = 0; i < MAXN; i++) work[i] = 0;
  for (long long a : l) work[a]++;
  for (long long b : u) work[b]--;
  long long cur = 0;
  for (long long a : l) cur += a;
  long long s = 0;
  long long psum = 0;
  while (true) {
    psum += work[s];
    if (cur <= total && total <= cur + psum) {
      break;
    }
    cur += psum;
    s++;
  }
  vector<long long> ret(l.size());
  long long extra = total - cur;
  for (long long i = 0; i < (long long)ret.size(); i++) {
    if (extra && l[i] <= s && s + 1 <= u[i]) {
      ret[i] = s + 1;
      extra--;
    } else if (l[i] <= s && s <= u[i]) {
      ret[i] = s;
    } else if (s < l[i]) {
      ret[i] = l[i];
    } else {
      ret[i] = u[i];
    }
    total -= ret[i];
  }
  assert(total == 0);
  return ret;
}
vector<long long> set_make(vector<long long> l, vector<long long> u,
                           long long cnt, long long val, long long total) {
  for (long long j = 0; j < cnt; j++) l[j] = max(l[j], val);
  for (long long& x : u) x = min(x, val);
  for (long long j = 0; j < (long long)l.size(); j++)
    if (u[j] < l[j]) return {};
  vector<long long> res = make(l, u, total);
  return res;
}
bool okay(vector<long long> a, vector<long long> b) {
  if (a.empty()) return false;
  sort(a.begin(), a.end());
  reverse(a.begin(), a.end());
  sort(b.begin(), b.end());
  long long n = (long long)a.size();
  long long m = (long long)b.size();
  long long asum = 0;
  long long j = 0;
  long long bsum = 0;
  for (long long i = 1; i <= n; i++) {
    asum += a[i - 1];
    while (j < m && b[j] <= i) {
      bsum += b[j];
      j++;
    }
    if (asum > bsum + (m - j) * i) return false;
  }
  return true;
}
int main() {
  ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
  long long n, m;
  cin >> n >> m;
  vector<long long> l(n), u(n);
  for (long long i = 0; i < n; i++) cin >> l[i] >> u[i];
  vector<long long> lb(m, 0);
  vector<long long> ub(m, n);
  long long q;
  cin >> q;
  for (long long i = 0; i < q; i++) {
    long long p, s;
    cin >> p >> s;
    p--;
    lb[p] = s;
    ub[p] = s;
  }
  for (long long i = 1; i < m; i++) ub[i] = min(ub[i], ub[i - 1]);
  for (long long i = m - 2; i >= 0; i--) lb[i] = max(lb[i], lb[i + 1]);
  long long s = 0;
  long long e = m + 1;
  long long TOTAL;
  cin >> TOTAL;
  vector<long long> probs = make(l, u, TOTAL);
  vector<long long> people = make(lb, ub, TOTAL);
  if (probs.empty() || people.empty()) {
    cout << -1 << ' ' << -1 << '\n';
    return 0;
  }
  while (s + 1 < e) {
    long long mid = (s + e) / 2;
    long long maxcnt = mid;
    vector<long long> res = set_make(lb, ub, maxcnt, people[0], TOTAL);
    if (okay(res, probs)) {
      s = mid;
    } else {
      e = mid;
    }
  }
  if (s == 0) {
    cout << -1 << ' ' << -1 << '\n';
    return 0;
  }
  long long cnt = s;
  long long sv = people[0] - 1;
  long long ev = n + 1;
  while (sv + 1 < ev) {
    long long mv = (sv + ev) / 2;
    vector<long long> res = set_make(lb, ub, cnt, mv, TOTAL);
    if (okay(res, probs)) {
      sv = mv;
    } else {
      ev = mv;
    }
  }
  assert(sv >= people[0]);
  cout << cnt << ' ' << sv << '\n';
}
