import bisect

a,b,q=list(map(int,input().split()))

S,T=[],[]

for i in range(a):

  S.append(int(eval(input())))

for i in range(b):

  T.append(int(eval(input())))

def f(list,n):

  if n<list[0]:

    return [-float("inf"),list[0]]

  elif list[-1]<n:

    return [list[-1],float("inf")]

  else:

    i=bisect.bisect_left(list,n)

    return [list[i-1],list[i]]

def g(SS,TT,x):

  a,b,c,d=x-SS[0],SS[1]-x,x-TT[0],TT[1]-x

  dis1=max(a,c)

  dis2=min(2*a+d,2*d+a)

  dis3=max(b,d)

  dis4=min(2*b+c,2*c+b)

  return min([dis1,dis2,dis3,dis4])

for i in range(q):

  x=int(eval(input()))

  print((g(f(S,x),f(T,x),x)))
import bisect

import sys

input = sys.stdin.readline

a,b,q=list(map(int,input().split()))

S,T=[],[]

for i in range(a):

  S.append(int(eval(input())))

for i in range(b):

  T.append(int(eval(input())))

def f(list,n):

  if n<list[0]:

    return [-float("inf"),list[0]]

  elif list[-1]<n:

    return [list[-1],float("inf")]

  else:

    i=bisect.bisect_left(list,n)

    return [list[i-1],list[i]]

def g(SS,TT,x):

  a,b,c,d=x-SS[0],SS[1]-x,x-TT[0],TT[1]-x

  dis1=max(a,c)

  dis2=min(2*a+d,2*d+a)

  dis3=max(b,d)

  dis4=min(2*b+c,2*c+b)

  return min([dis1,dis2,dis3,dis4])

for i in range(q):

  x=int(eval(input()))

  print((g(f(S,x),f(T,x),x)))
import bisect

a, b, q = list(map(int, input().split()))
S, T = [], []
for i in range(a):
    S.append(int(eval(input())))
for i in range(b):
    T.append(int(eval(input())))


def f(list, n):
    if n < list[0]:
        return [-float("inf"), list[0]]
    elif list[-1] < n:
        return [list[-1], float("inf")]
    else:
        i = bisect.bisect_left(list, n)
        return [list[i - 1], list[i]]


def g(SS, TT, x):
    a, b, c, d = x - SS[0], SS[1] - x, x - TT[0], TT[1] - x
    dis1 = max(a, c)
    dis2 = min(2 * a + d, 2 * d + a)
    dis3 = max(b, d)
    dis4 = min(2 * b + c, 2 * c + b)
    return min([dis1, dis2, dis3, dis4])


for i in range(q):
    x = int(eval(input()))
    print((g(f(S, x), f(T, x), x)))

import bisect
import sys

input = sys.stdin.readline
a, b, q = list(map(int, input().split()))
S, T = [], []
for i in range(a):
    S.append(int(eval(input())))
for i in range(b):
    T.append(int(eval(input())))


def f(list, n):
    if n < list[0]:
        return [-float("inf"), list[0]]
    elif list[-1] < n:
        return [list[-1], float("inf")]
    else:
        i = bisect.bisect_left(list, n)
        return [list[i - 1], list[i]]


def g(SS, TT, x):
    a, b, c, d = x - SS[0], SS[1] - x, x - TT[0], TT[1] - x
    dis1 = max(a, c)
    dis2 = min(2 * a + d, 2 * d + a)
    dis3 = max(b, d)
    dis4 = min(2 * b + c, 2 * c + b)
    return min([dis1, dis2, dis3, dis4])


for i in range(q):
    x = int(eval(input()))
    print((g(f(S, x), f(T, x), x)))

+import sys +input = sys.stdin.readline