#include <bits/stdc++.h>
using namespace std;
const int MOD = 1e9 + 7;
const int MX = 2e5 + 5;
const long long INF = 1e18;
const long double PI = acos((long double)-1);
const int xd[4] = {1, 0, -1, 0}, yd[4] = {0, 1, 0, -1};
template <class T>
bool ckmin(T& a, const T& b) {
  return b < a ? a = b, 1 : 0;
}
template <class T>
bool ckmax(T& a, const T& b) {
  return a < b ? a = b, 1 : 0;
}
int pct(int x) { return __builtin_popcount(x); }
namespace input {
template <class T>
void re(complex<T>& x);
template <class T1, class T2>
void re(pair<T1, T2>& p);
template <class T>
void re(vector<T>& a);
template <class T, size_t SZ>
void re(array<T, SZ>& a);
template <class T>
void re(T& x) {
  cin >> x;
}
void re(double& x) {
  string t;
  re(t);
  x = stod(t);
}
void re(long double& x) {
  string t;
  re(t);
  x = stold(t);
}
template <class T, class... Ts>
void re(T& t, Ts&... ts) {
  re(t);
  re(ts...);
}
template <class T>
void re(complex<T>& x) {
  T a, b;
  re(a, b);
  x = {a, b};
}
template <class T1, class T2>
void re(pair<T1, T2>& p) {
  re(p.first, p.second);
}
template <class T>
void re(vector<T>& a) {
  for (int i = (0); i < ((int)a.size()); ++i) re(a[i]);
}
template <class T, size_t SZ>
void re(array<T, SZ>& a) {
  for (int i = (0); i < (SZ); ++i) re(a[i]);
}
}  // namespace input
using namespace input;
namespace output {
void pr(int x) { cout << x; }
void pr(long x) { cout << x; }
void pr(long long x) { cout << x; }
void pr(unsigned x) { cout << x; }
void pr(unsigned long x) { cout << x; }
void pr(unsigned long long x) { cout << x; }
void pr(float x) { cout << x; }
void pr(double x) { cout << x; }
void pr(long double x) { cout << x; }
void pr(char x) { cout << x; }
void pr(const char* x) { cout << x; }
void pr(const string& x) { cout << x; }
void pr(bool x) { pr(x ? "true" : "false"); }
template <class T>
void pr(const complex<T>& x) {
  cout << x;
}
template <class T1, class T2>
void pr(const pair<T1, T2>& x);
template <class T>
void pr(const T& x);
template <class T, class... Ts>
void pr(const T& t, const Ts&... ts) {
  pr(t);
  pr(ts...);
}
template <class T1, class T2>
void pr(const pair<T1, T2>& x) {
  pr("{", x.first, ", ", x.second, "}");
}
template <class T>
void pr(const T& x) {
  pr("{");
  bool fst = 1;
  for (const auto& a : x) pr(!fst ? ", " : "", a), fst = 0;
  pr("}");
}
void ps() { pr("\n"); }
template <class T, class... Ts>
void ps(const T& t, const Ts&... ts) {
  pr(t);
  if (sizeof...(ts)) pr(" ");
  ps(ts...);
}
void pc() { pr("]\n"); }
template <class T, class... Ts>
void pc(const T& t, const Ts&... ts) {
  pr(t);
  if (sizeof...(ts)) pr(", ");
  pc(ts...);
}
}  // namespace output
using namespace output;
namespace io {
void setIn(string second) { freopen(second.c_str(), "r", stdin); }
void setOut(string second) { freopen(second.c_str(), "w", stdout); }
void setIO(string second = "") {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  if ((int)second.size()) {
    setIn(second + ".in"), setOut(second + ".out");
  }
}
}  // namespace io
using namespace io;
mt19937 rng((uint32_t)chrono::steady_clock::now().time_since_epoch().count());
int n, m;
long long t;
vector<int> ques;
vector<pair<int, int> > Q, scores;
long long sum(vector<int> v) {
  long long res = 0;
  for (auto& t : v) res += t;
  return res;
}
vector<int> eval(int mid) {
  vector<int> cur;
  for (auto& t : Q) cur.push_back(min(max(t.first, mid), t.second));
  return cur;
}
void bad() {
  ps(-1, -1);
  exit(0);
}
void genQues() {
  int lo = 0, hi = m;
  if (sum(eval(lo)) > t || sum(eval(hi)) < t) bad();
  while (lo < hi) {
    int mid = (lo + hi) / 2;
    if (sum(eval(mid)) >= t)
      hi = mid;
    else
      lo = mid + 1;
  }
  vector<int> cur = eval(lo);
  long long csum = sum(cur);
  for (int i = (0); i < ((int)Q.size()); ++i)
    if (cur[i] == lo && lo > Q[i].first && csum > t) {
      cur[i]--;
      csum--;
    }
  assert(csum == t);
  ques = cur;
  sort(begin(ques), end(ques));
}
void init() {
  setIO();
  re(n, m);
  Q.resize(n);
  re(Q);
  int q;
  re(q);
  scores.resize(q);
  re(scores);
  scores.push_back({m + 1, 0});
  sort(begin(scores), end(scores));
  re(t);
  genQues();
}
long long cdiv(long long a, long long b) { return (a + b - 1) / b; }
bool check(vector<int> rec) {
  assert((int)rec.size() == m + 1);
  assert(sum(rec) == t);
  for (int i = (2); i < (m + 1); ++i) assert(rec[i] <= rec[i - 1]);
  long long a = 0, b = 0;
  int ind = 0;
  for (int i = (1); i < (m + 1); ++i) {
    a += rec[i];
    while (ind < n && ques[ind] <= i) b += ques[ind++];
    if (a > b + (long long)(n - ind) * i) return 0;
  }
  assert(a == b);
  return 1;
}
bool ok(int mid) {
  for (auto& t : scores)
    if (t.first <= mid && t.second != scores[0].second) return 0;
  vector<int> rec = {0};
  int lst = scores[0].second, pos = 0;
  for (int i = (1); i < (m + 1); ++i) {
    if (pos < (int)scores.size() && scores[pos].first == i)
      lst = scores[pos++].second;
    rec.push_back(lst);
  }
  long long csum = sum(rec);
  assert(csum >= t);
  int pre = mid;
  for (auto& u : scores)
    if (u.first > pre) {
      long long dif = rec[u.first - 1] - u.second;
      long long maxDec = dif * (u.first - 1 - pre);
      ckmin(maxDec, csum - t);
      for (int j = (pre + 1); j < (u.first); ++j) {
        long long amt = min(dif, maxDec / (u.first - j));
        rec[j] -= amt;
        maxDec -= amt;
        csum -= amt;
      }
      pre = u.first;
    }
  if (csum != t) return 0;
  return check(rec);
}
long long getMax() {
  if (!(int)scores.size()) return 0;
  int lst = scores[0].second, pos = 0;
  long long ret = 0;
  for (int i = (1); i < (m + 1); ++i) {
    if (pos < (int)scores.size() && scores[pos].first == i) {
      lst = scores[pos++].second;
    }
    ret += lst;
  }
  return ret;
}
int solve() {
  if (!ok(scores[0].first)) return -1;
  int lo = scores[0].first, hi = m;
  while (lo < hi) {
    int mid = (lo + hi + 1) / 2;
    if (ok(mid))
      lo = mid;
    else
      hi = mid - 1;
  }
  return lo;
}
int maxPosi(long long need) {
  if (need > n) return -1;
  scores.insert(begin(scores), {1, need});
  int x = solve();
  scores.erase(begin(scores));
  return x;
}
int main() {
  init();
  long long dif = t - getMax();
  if (dif > 0) {
    int fst = scores[0].first - 1;
    if (fst == 0) bad();
    long long need = cdiv(dif, fst) + scores[0].second;
    int x = maxPosi(need);
    if (x == -1) bad();
    int lo = need, hi = n;
    while (lo < hi) {
      long long mid = (lo + hi + 1) / 2;
      if (maxPosi(mid) == x)
        lo = mid;
      else
        hi = mid - 1;
    }
    ps(x, lo);
  } else {
    int x = solve();
    if (x == -1) bad();
    ps(x, scores[0].second);
  }
}
