#include <bits/stdc++.h>
using namespace std;
int main() {
  int e, s, n, m;
  cin >> e >> s >> n >> m;
  vector<pair<int, int>> v, f;
  for (int i = 0; i < n; i++) {
    int x, t;
    cin >> t >> x;
    if (x < e) v.emplace_back(-x, t - 1);
  }
  e = -e;
  v.emplace_back(e, 2);
  for (int i = 0; i < m; i++) {
    int ff;
    cin >> ff;
    f.emplace_back(-ff, i);
  }
  sort(v.begin(), v.end());
  sort(f.begin(), f.end());
  int p = 0, j = 0, i;
  deque<int> gas[3];
  vector<vector<int>> pans(v.size()), ans(m, vector<int>(3, -1));
  pans[0] = vector<int>(3, 0);
  gas[2].push_back(0);
  for (i = 1; i < v.size(); i++) {
    while (p < f.size() and f[p].first < v[i].first) {
      while (j < i and f[p].first - v[j].first > s) {
        gas[v[j].second].pop_back();
        j++;
      }
      if (j == i) break;
      if (gas[2].size()) {
        ans[f[p].second] = pans[gas[2].front()];
      } else {
        int g;
        for (g = 1; g > -1 and gas[g].empty(); g--)
          ;
        assert(g > -1);
        ans[f[p].second] = pans[gas[g].back()];
        int d = f[p].first - v[gas[g].back()].first;
        ans[f[p].second][g] -= s - d;
      }
      p++;
    }
    while (j < i and v[i].first - v[j].first > s) {
      gas[v[j].second].pop_back();
      j++;
    }
    if (i == j) break;
    int nx = -1;
    for (int g = v[i].second; g < 3; g++) {
      if (gas[g].size()) nx = max(nx, gas[g].front());
    }
    if (nx != -1) {
      int d = v[i].first - v[nx].first;
      pans[i] = pans[nx];
      pans[i][v[i].second] += d;
    } else {
      int g;
      for (g = v[i].second - 1; g > -1 and gas[g].empty(); g--)
        ;
      assert(g > -1);
      pans[i] = pans[gas[g].back()];
      int d = v[i].first - v[gas[g].back()].first;
      pans[i][v[i].second] += s;
      pans[i][g] -= s - d;
    }
    gas[v[i].second].push_front(i);
  }
  while (p < f.size()) {
    while (j < i and f[p].first - v[j].first > s) {
      gas[v[j].second].pop_back();
      j++;
    }
    if (j == i) break;
    if (gas[2].size()) {
      ans[f[p].second] = pans[gas[2].front()];
    } else {
      int g;
      for (g = 1; g > -1 and gas[g].empty(); g--)
        ;
      ans[f[p].second] = pans[gas[g].back()];
      int d = f[p].first - v[gas[g].back()].first;
      ans[f[p].second][g] -= s - d;
    }
    p++;
  }
  for (int i = 0; i < m; i++) {
    cout << ans[i][0] << ' ' << ans[i][1] << endl;
  }
}
