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

from sys import maxint

N, M, numStairs, numElevs, speedElev = map(int,raw_input().split())
stairs = map(int,raw_input().split())
elevs = map(int,raw_input().split())

def binarySearch(arr, l, r, x) :
    if l >= r-1 : return l
    mid = (l+r) / 2
    if x < arr[mid] :
        return binarySearch(arr,l,mid,x)
    elif x > arr[mid] :
        return binarySearch(arr,mid,r,x)
    return mid

Q = int(raw_input())
for q in range(Q) :
    f1, r1, f2, r2 = map(lambda x:int(x)-1,raw_input().split())

    # if same floor, trivial
    if f1 == f2 : 
        print abs(r2-r1)
        continue

    best = maxint
    df = abs(f1-f2)
    
    leftStair = binarySearch(stairs, 0, len(stairs), r1)
    leftElev = binarySearch(elevs, 0, len(elevs), r1)

    # try left stairs
    if numStairs > 0 : 
        t = abs(r1-stairs[leftStair]-1) + \
            df + \
            abs(r2-stairs[leftStair]-1)
        best = min(best,t)

    # try right stairs
    if numStairs > 1 and leftStair+1 < numStairs :
        t = abs(r1-stairs[leftStair+1]-1) + \
            df + \
            abs(r2-stairs[leftStair+1]-1)
        best = min(best,t)

    # try left elevs
    if numElevs > 0 :
        t = abs(r1-elevs[leftElev]-1) + \
            (df/speedElev + int(df%speedElev > 0)) + \
            abs(r2-elevs[leftElev]-1)
        best = min(best,t)

    # try right elevs
    if numElevs > 1 and leftElev+1 < numElevs :
        t = abs(r1-elevs[leftElev+1]-1) + \
            (df/speedElev + int(df%speedElev > 0)) + \
            abs(r2-elevs[leftElev+1]-1)
        best = min(best,t)

    print best

