2 10 1 1 1
1
10
1
1 5 1 8
 4 4 1 0 1
1

1
1 2 1 4
 2 5 1 0 1
2

1
1 4 1 5
 10 10 1 8 4
10
2 3 4 5 6 7 8 9
10
1 1 3 1
2 1 7 1
1 1 9 1
7 1 4 1
10 1 7 1
2 1 7 1
3 1 2 1
5 1 2 1
10 1 5 1
6 1 9 1
 2 4 1 1 1
1
4
1
1 2 1 3
 2 2 0 1 1

1
1
1 2 2 2
 1000 1000 1 1 10
1
2
1
1 900 1 1000
 5 5 1 1 1
3
2
1
1 5 1 1
 2 4 1 1 1
1
2
1
2 3 2 4
 4 4 1 0 1
4

5
1 1 2 2
1 3 2 2
3 3 4 3
3 2 2 2
1 2 2 3

3
 2
 1
 3
4
4
3
3
4
3
3
4
3
 1
 3
 100
 4
 1
 6
4
3
5
4

#include <bits/stdc++.h>
using namespace std;
inline int mod(int a);
inline int mod_dist(int **q, int i, double *path, int a, int j);
int binary_search(double *path, int start1, int end1, double a);
int main() {
  int n, m, nos, noe, v, queries;
  cin >> n >> m >> nos >> noe >> v;
  double *stairs = new double[nos];
  for (int i = 0; i < nos; i++) cin >> stairs[i];
  double *elevators = new double[noe];
  for (int i = 0; i < noe; i++) cin >> elevators[i];
  cin >> queries;
  int **q = new int *[queries];
  for (int i = 0; i < queries; i++) {
    q[i] = new int[4];
    cin >> q[i][0] >> q[i][1] >> q[i][2] >> q[i][3];
  }
  double min_stairs = 10000000, min_elevators = 10000000;
  for (int i = 0; i < queries; i++) {
    double a = (static_cast<double>(q[i][1]) - q[i][3]) / 2;
    int j1 = binary_search(stairs, 0, nos - 1, a);
    int j2 = binary_search(elevators, 0, noe - 1, a);
    if (nos > 0)
      min_stairs = mod_dist(q, i, stairs, nos, j1) +
                   static_cast<double>(mod(q[i][0] - q[i][2]));
    if (noe > 0)
      min_elevators = mod_dist(q, i, elevators, noe, j2) +
                      static_cast<double>(mod(q[i][0] - q[i][2])) / v;
  }
}
int binary_search(double *path, int start1, int end1, double a) {
  int start = start1;
  int end = end1;
  while (start < end) {
    int mid = (start + end) / 2;
    if (path[mid] < a)
      start = mid + 1;
    else if (path[mid] == a) {
      start = mid;
      end = mid;
    } else
      end = mid;
  }
  return start;
}
inline int mod_dist(int **q, int i, double *path, int a, int j) {
  int temp1 = 10000000, temp2 = 10000000;
  if (j > 0) temp1 = mod(path[j - 1] - q[i][1]) + mod(path[j - 1] - q[i][3]);
  cout << temp1 << "  ";
  temp2 = mod(path[j] - q[i][1]) + mod(path[j] - q[i][3]);
  cout << temp2;
  if (temp1 < temp2)
    return temp1;
  else
    return temp2;
}
inline int mod(int a) {
  if (a < 0)
    return (-1 * a);
  else
    return a;
}
