import bisect
import sys
sys.setrecursionlimit(10**9)

def mi(): return map(int,input().split())
def ii(): return int(input())
def isp(): return input().split()
def deb(text): print("-------\n{}\n-------".format(text))

INF = 10**20
def main():
    A,B,Q=mi()
    X,Y= [], []
    for i in range(A):
        X.append(ii())
    for i in range(B):
        Y.append(ii())
    
    def search_min_dist(Z,z):
        insert_i = bisect.bisect_left(Z,z)
        res = []
        m = INF
        for di in [-2,-1,0,1,2]:
            i = insert_i + di
           
            if 0<= i < len(Z):
                res.append(Z[i])

        return res


    for q in range(Q):
        x=ii()
        minX = search_min_dist(X,x)
        minY = search_min_dist(Y,x)

        ans = INF
        for mx in minX:
            for my in minY:
                min_dist_x,min_dist_y = mx,my
                if not min_dist_x < min_dist_y:
                    min_dist_x,min_dist_y = min_dist_y,min_dist_x

                _ans = 0
                if min_dist_x <= x <= min_dist_y:
                    _ans = min(min_dist_y-x,x-min_dist_x) + min_dist_y - min_dist_x
                elif x <= min_dist_x <= min_dist_y:
                    _ans = min_dist_y - x
                else:
                    _ans = -min_dist_x + x
                
    
                ans = min(ans,_ans)
        print(ans)

        

if __name__ == "__main__":
    main() import bisect bisect import sys sys sys.setrecursionlimit(10**9) sys.setrecursionlimit sys setrecursionlimit 10**9 10 9 def mi(): return map(int,input().split()) mi def ii(): return int(input()) ii def isp(): return input().split() isp def deb(text): print("-------\n{}\n-------".format(text)) deb text text INF = 10**20 INF 10**20 10 20 def main():
    A,B,Q=mi()
    X,Y= [], []
    for i in range(A):
        X.append(ii())
    for i in range(B):
        Y.append(ii())
    
    def search_min_dist(Z,z):
        insert_i = bisect.bisect_left(Z,z)
        res = []
        m = INF
        for di in [-2,-1,0,1,2]:
            i = insert_i + di
           
            if 0<= i < len(Z):
                res.append(Z[i])

        return res


    for q in range(Q):
        x=ii()
        minX = search_min_dist(X,x)
        minY = search_min_dist(Y,x)

        ans = INF
        for mx in minX:
            for my in minY:
                min_dist_x,min_dist_y = mx,my
                if not min_dist_x < min_dist_y:
                    min_dist_x,min_dist_y = min_dist_y,min_dist_x

                _ans = 0
                if min_dist_x <= x <= min_dist_y:
                    _ans = min(min_dist_y-x,x-min_dist_x) + min_dist_y - min_dist_x
                elif x <= min_dist_x <= min_dist_y:
                    _ans = min_dist_y - x
                else:
                    _ans = -min_dist_x + x
                
    
                ans = min(ans,_ans)
        print(ans)

         main A,B,Q=mi() A mi() mi B Q X,Y= [], [] X [] Y [] for i in range(A):
        X.append(ii())
     i range(A) range A X.append(ii()) X.append X append ii() ii for i in range(B):
        Y.append(ii())
    
     i range(B) range B Y.append(ii()) Y.append Y append ii() ii def search_min_dist(Z,z):
        insert_i = bisect.bisect_left(Z,z)
        res = []
        m = INF
        for di in [-2,-1,0,1,2]:
            i = insert_i + di
           
            if 0<= i < len(Z):
                res.append(Z[i])

        return res


     search_min_dist insert_i = bisect.bisect_left(Z,z) insert_i bisect.bisect_left(Z,z) bisect.bisect_left bisect bisect_left Z z res = [] res [] m = INF m INF for di in [-2,-1,0,1,2]:
            i = insert_i + di
           
            if 0<= i < len(Z):
                res.append(Z[i])

         di [-2,-1,0,1,2] -2 -1 0 1 2 i = insert_i + di i insert_i + di insert_i di if 0<= i < len(Z):
                res.append(Z[i])

         0<= i < len(Z) 0<= i 0 i len(Z) len Z res.append(Z[i]) res.append res append Z[i] Z i return res res Z Z z z for q in range(Q):
        x=ii()
        minX = search_min_dist(X,x)
        minY = search_min_dist(Y,x)

        ans = INF
        for mx in minX:
            for my in minY:
                min_dist_x,min_dist_y = mx,my
                if not min_dist_x < min_dist_y:
                    min_dist_x,min_dist_y = min_dist_y,min_dist_x

                _ans = 0
                if min_dist_x <= x <= min_dist_y:
                    _ans = min(min_dist_y-x,x-min_dist_x) + min_dist_y - min_dist_x
                elif x <= min_dist_x <= min_dist_y:
                    _ans = min_dist_y - x
                else:
                    _ans = -min_dist_x + x
                
    
                ans = min(ans,_ans)
        print(ans)

         q range(Q) range Q x=ii() x ii() ii minX = search_min_dist(X,x) minX search_min_dist(X,x) search_min_dist X x minY = search_min_dist(Y,x) minY search_min_dist(Y,x) search_min_dist Y x ans = INF ans INF for mx in minX:
            for my in minY:
                min_dist_x,min_dist_y = mx,my
                if not min_dist_x < min_dist_y:
                    min_dist_x,min_dist_y = min_dist_y,min_dist_x

                _ans = 0
                if min_dist_x <= x <= min_dist_y:
                    _ans = min(min_dist_y-x,x-min_dist_x) + min_dist_y - min_dist_x
                elif x <= min_dist_x <= min_dist_y:
                    _ans = min_dist_y - x
                else:
                    _ans = -min_dist_x + x
                
    
                ans = min(ans,_ans)
         mx minX for my in minY:
                min_dist_x,min_dist_y = mx,my
                if not min_dist_x < min_dist_y:
                    min_dist_x,min_dist_y = min_dist_y,min_dist_x

                _ans = 0
                if min_dist_x <= x <= min_dist_y:
                    _ans = min(min_dist_y-x,x-min_dist_x) + min_dist_y - min_dist_x
                elif x <= min_dist_x <= min_dist_y:
                    _ans = min_dist_y - x
                else:
                    _ans = -min_dist_x + x
                
    
                ans = min(ans,_ans)
         my minY min_dist_x,min_dist_y = mx,my min_dist_x mx min_dist_y my if not min_dist_x < min_dist_y:
                    min_dist_x,min_dist_y = min_dist_y,min_dist_x

                 not min_dist_x < min_dist_y min_dist_x < min_dist_y min_dist_x min_dist_y min_dist_x,min_dist_y = min_dist_y,min_dist_x min_dist_x min_dist_y min_dist_y min_dist_x _ans = 0 _ans 0 if min_dist_x <= x <= min_dist_y:
                    _ans = min(min_dist_y-x,x-min_dist_x) + min_dist_y - min_dist_x
                elif x <= min_dist_x <= min_dist_y:
                    _ans = min_dist_y - x
                else:
                    _ans = -min_dist_x + x
                
    
                 min_dist_x <= x <= min_dist_y min_dist_x <= x min_dist_x x min_dist_y _ans = min(min_dist_y-x,x-min_dist_x) + min_dist_y - min_dist_x _ans min(min_dist_y-x,x-min_dist_x) + min_dist_y - min_dist_x min(min_dist_y-x,x-min_dist_x) + min_dist_y min(min_dist_y-x,x-min_dist_x) min min_dist_y-x min_dist_y x x-min_dist_x x min_dist_x min_dist_y min_dist_x elif x <= min_dist_x <= min_dist_y:
                    _ans = min_dist_y - x
                 x <= min_dist_x <= min_dist_y x <= min_dist_x x min_dist_x min_dist_y _ans = min_dist_y - x _ans min_dist_y - x min_dist_y x _ans = -min_dist_x + x _ans -min_dist_x + x -min_dist_x min_dist_x x ans = min(ans,_ans) ans min(ans,_ans) min ans _ans print(ans) print ans if __name__ == "__main__":
    main() __name__ == "__main__" __name__ "__main__" main() main def deb(text): print("-------\n{}\n-------".format(text)) def deb(text): print("-------\n{}\n-------".format(text)) deb def main():
    A,B,Q=mi()
    X,Y= [], []
    for i in range(A):
        X.append(ii())
    for i in range(B):
        Y.append(ii())
    
    def search_min_dist(Z,z):
        insert_i = bisect.bisect_left(Z,z)
        res = []
        m = INF
        for di in [-2,-1,0,1,2]:
            i = insert_i + di
           
            if 0<= i < len(Z):
                res.append(Z[i])

        return res


    for q in range(Q):
        x=ii()
        minX = search_min_dist(X,x)
        minY = search_min_dist(Y,x)

        ans = INF
        for mx in minX:
            for my in minY:
                min_dist_x,min_dist_y = mx,my
                if not min_dist_x < min_dist_y:
                    min_dist_x,min_dist_y = min_dist_y,min_dist_x

                _ans = 0
                if min_dist_x <= x <= min_dist_y:
                    _ans = min(min_dist_y-x,x-min_dist_x) + min_dist_y - min_dist_x
                elif x <= min_dist_x <= min_dist_y:
                    _ans = min_dist_y - x
                else:
                    _ans = -min_dist_x + x
                
    
                ans = min(ans,_ans)
        print(ans)

         def main():
    A,B,Q=mi()
    X,Y= [], []
    for i in range(A):
        X.append(ii())
    for i in range(B):
        Y.append(ii())
    
    def search_min_dist(Z,z):
        insert_i = bisect.bisect_left(Z,z)
        res = []
        m = INF
        for di in [-2,-1,0,1,2]:
            i = insert_i + di
           
            if 0<= i < len(Z):
                res.append(Z[i])

        return res


    for q in range(Q):
        x=ii()
        minX = search_min_dist(X,x)
        minY = search_min_dist(Y,x)

        ans = INF
        for mx in minX:
            for my in minY:
                min_dist_x,min_dist_y = mx,my
                if not min_dist_x < min_dist_y:
                    min_dist_x,min_dist_y = min_dist_y,min_dist_x

                _ans = 0
                if min_dist_x <= x <= min_dist_y:
                    _ans = min(min_dist_y-x,x-min_dist_x) + min_dist_y - min_dist_x
                elif x <= min_dist_x <= min_dist_y:
                    _ans = min_dist_y - x
                else:
                    _ans = -min_dist_x + x
                
    
                ans = min(ans,_ans)
        print(ans)

         main def isp(): return input().split() def isp(): return input().split() isp def mi(): return map(int,input().split()) def mi(): return map(int,input().split()) mi def ii(): return int(input()) def ii(): return int(input()) ii INF = 10**20 10**20 INF
import bisect
import sys
sys.setrecursionlimit(10**9)

def mi(): return map(int,input().split())
def ii(): return int(input())
def isp(): return input().split()
def deb(text): print("-------\n{}\n-------".format(text))

INF = 10**20
def main():
    A,B,Q=mi()
    X,Y= [], []
    for i in range(A):
        X.append(ii())
    for i in range(B):
        Y.append(ii())
    
    def search_min_dist(Z,z):
        insert_i = bisect.bisect_left(Z,z)
        res = []
        m = INF
        for di in [-2,-1,0,1,2]:
            i = insert_i + di
           
            if 0<= i < len(Z):
                res.append(Z[i])

        return res


    for q in range(Q):
        x=ii()
        minX = search_min_dist(X,x)
        minY = search_min_dist(Y,x)

        ans = INF
        for mx in minX:
            for my in minY:
                min_dist_x,min_dist_y = mx,my
                if not min_dist_x < min_dist_y:
                    min_dist_x,min_dist_y = min_dist_y,min_dist_x

                _ans = 0
                if min_dist_x <= x <= min_dist_y:
                    _ans = min(min_dist_y-x,x-min_dist_x) + min_dist_y - min_dist_x
                elif x <= min_dist_x <= min_dist_y:
                    _ans = min_dist_y - x
                else:
                    _ans = -min_dist_x + x
                
    
                ans = min(ans,_ans)
        print(ans)

        

if __name__ == "__main__":
    main()