import bisect

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

s=[-999999999999]+[int(eval(input())) for i in range(a)]+[999999999999]

t=[-999999999999]+[int(eval(input())) for i in range(b)]+[999999999999]

x=[int(eval(input())) for i in range(q)]

for i in range(q):

  a1=s[bisect.bisect_left(s,x[i])-1]

  a2=s[bisect.bisect_left(s,x[i])]

  b1=t[bisect.bisect_left(t,x[i])-1]

  b2=t[bisect.bisect_left(t,x[i])]

  l=[]

  for j in [a1,a2]:

    for k in [b1,b2]:

      l.append(abs(j-k)+min(abs(x[i]-j),abs(x[i]-k)))

  print((min(l)))
import bisect

import sys

input=sys.stdin.readline

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

s=[-999999999999]+[int(eval(input())) for i in range(a)]+[999999999999]

t=[-999999999999]+[int(eval(input())) for i in range(b)]+[999999999999]

x=[int(eval(input())) for i in range(q)]

for i in range(q):

  a1=s[bisect.bisect_left(s,x[i])-1]

  a2=s[bisect.bisect_left(s,x[i])]

  b1=t[bisect.bisect_left(t,x[i])-1]

  b2=t[bisect.bisect_left(t,x[i])]

  l=[]

  for j in [a1,a2]:

    for k in [b1,b2]:

      l.append(abs(j-k)+min(abs(x[i]-j),abs(x[i]-k)))

  print((min(l)))
import bisect

a, b, q = list(map(int, input().split()))
s = [-999999999999] + [int(eval(input())) for i in range(a)] + [999999999999]
t = [-999999999999] + [int(eval(input())) for i in range(b)] + [999999999999]
x = [int(eval(input())) for i in range(q)]
for i in range(q):
    a1 = s[bisect.bisect_left(s, x[i]) - 1]
    a2 = s[bisect.bisect_left(s, x[i])]
    b1 = t[bisect.bisect_left(t, x[i]) - 1]
    b2 = t[bisect.bisect_left(t, x[i])]
    l = []
    for j in [a1, a2]:
        for k in [b1, b2]:
            l.append(abs(j - k) + min(abs(x[i] - j), abs(x[i] - k)))
    print((min(l)))

import bisect
import sys

input = sys.stdin.readline
a, b, q = list(map(int, input().split()))
s = [-999999999999] + [int(eval(input())) for i in range(a)] + [999999999999]
t = [-999999999999] + [int(eval(input())) for i in range(b)] + [999999999999]
x = [int(eval(input())) for i in range(q)]
for i in range(q):
    a1 = s[bisect.bisect_left(s, x[i]) - 1]
    a2 = s[bisect.bisect_left(s, x[i])]
    b1 = t[bisect.bisect_left(t, x[i]) - 1]
    b2 = t[bisect.bisect_left(t, x[i])]
    l = []
    for j in [a1, a2]:
        for k in [b1, b2]:
            l.append(abs(j - k) + min(abs(x[i] - j), abs(x[i] - k)))
    print((min(l)))

+import sys +input = sys.stdin.readline