from bisect import *
a,b,q=map(int,input().split())
s,t=[],[]
for i in range(a):
    s.append(int(input()))
for i in range(b):
    t.append(int(input()))
for i in range(q):
    x=int(input())
    bs=bisect_left(s,x)
    if bs!=0:
        sl=x-s[bs-1]
    else:
        sl=float("inf")
    if bs!=a:
        sr=s[bs]-x
    else:
        sr=float("inf")
    bt=bisect_left(t,x)
    if bt!=0:
        tl=x-t[bt-1]
    else:
        tl=float("inf")
    if bt!=b:
        tr=t[bt]-x
    else:
        tr=float("inf")
    print(min(max(sl,tl),max(sr,tr),2*sl+tr,2*tl+sr,sl+tr*2,tl+sr*2)) from bisect import * a,b,q=map(int,input().split()) a map(int,input().split()) map int input().split() ().split () input split b q s,t=[],[] s [] t [] for i in range(a):
    s.append(int(input())) i range(a) range a s.append(int(input())) s.append s append int(input()) int input() input for i in range(b):
    t.append(int(input())) i range(b) range b t.append(int(input())) t.append t append int(input()) int input() input for i in range(q):
    x=int(input())
    bs=bisect_left(s,x)
    if bs!=0:
        sl=x-s[bs-1]
    else:
        sl=float("inf")
    if bs!=a:
        sr=s[bs]-x
    else:
        sr=float("inf")
    bt=bisect_left(t,x)
    if bt!=0:
        tl=x-t[bt-1]
    else:
        tl=float("inf")
    if bt!=b:
        tr=t[bt]-x
    else:
        tr=float("inf")
    print(min(max(sl,tl),max(sr,tr),2*sl+tr,2*tl+sr,sl+tr*2,tl+sr*2)) i range(q) range q x=int(input()) x int(input()) int input() input bs=bisect_left(s,x) bs bisect_left(s,x) bisect_left s x if bs!=0:
        sl=x-s[bs-1]
    else:
        sl=float("inf")
     bs!=0 bs 0 sl=x-s[bs-1] sl x-s[bs-1] x s[bs-1] s bs-1 bs 1 sl=float("inf") sl float("inf") float "inf" if bs!=a:
        sr=s[bs]-x
    else:
        sr=float("inf")
     bs!=a bs a sr=s[bs]-x sr s[bs]-x s[bs] s bs x sr=float("inf") sr float("inf") float "inf" bt=bisect_left(t,x) bt bisect_left(t,x) bisect_left t x if bt!=0:
        tl=x-t[bt-1]
    else:
        tl=float("inf")
     bt!=0 bt 0 tl=x-t[bt-1] tl x-t[bt-1] x t[bt-1] t bt-1 bt 1 tl=float("inf") tl float("inf") float "inf" if bt!=b:
        tr=t[bt]-x
    else:
        tr=float("inf")
     bt!=b bt b tr=t[bt]-x tr t[bt]-x t[bt] t bt x tr=float("inf") tr float("inf") float "inf" print(min(max(sl,tl),max(sr,tr),2*sl+tr,2*tl+sr,sl+tr*2,tl+sr*2)) print min(max(sl,tl),max(sr,tr),2*sl+tr,2*tl+sr,sl+tr*2,tl+sr*2) min max(sl,tl) max sl tl max(sr,tr) max sr tr 2*sl+tr 2*sl 2 sl tr 2*tl+sr 2*tl 2 tl sr sl+tr*2 sl tr*2 tr 2 tl+sr*2 tl sr*2 sr 2 t=[],[] [] t b,q=map(int,input().split()) map(int,input().split()) b x=int(input()) int(input()) x a,b,q=map(int,input().split()) map(int,input().split()) a sr=float("inf") float("inf") sr tr=float("inf") float("inf") tr tl=x-t[bt-1] x-t[bt-1] tl s,t=[],[] [] s tl=float("inf") float("inf") tl bs=bisect_left(s,x) bisect_left(s,x) bs sl=float("inf") float("inf") sl bt=bisect_left(t,x) bisect_left(t,x) bt q=map(int,input().split()) map(int,input().split()) q sl=x-s[bs-1] x-s[bs-1] sl tr=t[bt]-x t[bt]-x tr sr=s[bs]-x s[bs]-x sr
from bisect import *
a,b,q=map(int,input().split())
s,t=[],[]
for i in range(a):
    s.append(int(input()))
for i in range(b):
    t.append(int(input()))
for i in range(q):
    x=int(input())
    bs=bisect_left(s,x)
    if bs!=0:
        sl=x-s[bs-1]
    else:
        sl=float("inf")
    if bs!=a:
        sr=s[bs]-x
    else:
        sr=float("inf")
    bt=bisect_left(t,x)
    if bt!=0:
        tl=x-t[bt-1]
    else:
        tl=float("inf")
    if bt!=b:
        tr=t[bt]-x
    else:
        tr=float("inf")
    print(min(max(sl,tl),max(sr,tr),2*sl+tr,2*tl+sr,sl+tr*2,tl+sr*2))
