# Original solution
import sys
input = sys.stdin.readline

class AvlTree:
    """ Avl木を表現するクラス """
    def __init__(self):
        self.avl = [None,None,None,0]

    def node(self,key):
        return [None,key,None,0]

    # search(x) xが存在するならTrueをしないならFalseを返す
    def search(self,key,avl=None):
        if avl == None:
            avl = self.avl
        if key == avl[1]:
            return True
        elif key < avl[1]:
            if avl[0] == None:
                return False
            else:
                return self.search(key,avl[0])
        elif avl[1] < key:
            if avl[2] == None:
                return False
            else:
                return self.search(key,avl[2])

    def search_lower(self,key,key_lower=None,avl=0):
        if avl == 0:
            avl = self.avl
        if avl == None:
            return key_lower
        elif key < avl[1]:
            if avl[0] == None:
                return key_lower
            else:
                return self.search_lower(key,key_lower,avl[0])
        elif avl[1] < key:
            key_lower = avl[1]
            if avl[2] == None:
                return key_lower
            else:
                return self.search_lower(key,key_lower,avl[2])
        #avl[1] == keyの場合
        if avl[0] == None:
            return key_lower
        else:
            if key_lower == None:
                return self.end_higher(avl[0][1],avl[0])
            else:
                return max(key_lower,self.end_higher(avl[0][1],avl[0]))

    def search_higher(self,key,key_higher=None,avl=0):
        if avl == 0:
            avl = self.avl
        if avl == None:
            return key_higher
        if  key < avl[1]:
            key_higher = avl[1]
            if avl[0] == None:
                return key_higher
            else:
                return self.search_higher(key,key_higher,avl[0])
        if avl[1] < key:
            if avl[2] == None:
                return key_higher
            else:
                return self.search_higher(key,key_higher,avl[2])
        #self.key == keyの場合
        if avl[2] == None:
            return key_higher
        else:
            if key_higher == None:
                return self.end_lower(avl[2][1],avl[2])
            else:
                return min(key_higher,self.end_lower(avl[2][1],avl[2]))

    def end_lower(self,end_lower_key,avl=None):
        if avl == None:
            avl = self.avl
        if avl[0] == None:
            return end_lower_key
        else:
            end_lower_key = avl[0][1]
            return self.end_lower(end_lower_key,avl[0])
    def end_higher(self,end_higher_key,avl=None):
        if avl == None:
            avl = self.avl
        if avl[2] == None:
            return end_higher_key
        else:
            end_higher_key = avl[2][1]
            return self.end_higher(end_higher_key,avl[2])

    def DoubleRightRotation(self,avl):
        tl = avl[0]
        avl[0] = tl[2][2]
        tl[2][2] = avl # selfはそのノード
        tlr = tl[2]
        tl[2] = tlr[0]
        tlr[0] = tl
        if tlr[3] == 1:
            tlr[2][3] = 2
            tlr[0][3] = 0
        elif tlr[3] == 2:
            tlr[2][3] = 0
            tlr[0][3] = 1
        elif tlr[3] == 0:
            tlr[2][3] = 0
            tlr[0][3] = 0
        tlr[3] = 0
        return tlr

    def DoubleLeftRotation(self,avl):
        tr = avl[2]
        avl[2] = tr[0][0]
        tr[0][0] = avl
        trl = tr[0]
        tr[0] = trl[2]
        trl[2] = tr
        if trl[3] == 2:
            trl[0][3] = 1
            trl[2][3] = 0
        elif trl.balance == 1:
            trl[0][3] = 0
            trl[2][3] = 2
        elif trl.balance == 0:
            trl[0][3] = 0
            trl[2][3] = 0
        trl[3] = 0
        return trl

    def SingleLeftRotation(self,avl):
        tr = avl[2]
        tr[3] = 0
        avl[3] = 0
        avl[2] = tr[0]
        tr[0] = avl
        return tr

    def SingleRightRotation(self,avl):
        tl = avl[0]
        tl[3] = 0
        avl[3] = 0
        avl[0] = tl[2]
        tl[2] = avl
        return tl

    def replace(self,p,v,avl): # 親ノードpの下にある自分(avl)をvに置き換える。
        if p[0] is avl:
            p[0] = v
        else :
            p[2] = v

    def insert(self,key): # rootでのみ呼ばれる挿入
        if self.avl[1] == None: # rootを含むrotationはしないことにする。
            self.avl[1] = key
            return self.avl
        if key < self.avl[1]:
            if self.avl[0] == None:
                self.avl[0] = self.node(key)
            else:
                self.insertx(self.avl,key,self.avl[0])
        elif self.avl[1] < key:
            if self.avl[2] == None:
                self.avl[2] = self.node(key)
            else:
                self.insertx(self.avl,key,self.avl[2])
        else: # key == self.avl[1]:
            pass # do not overwrite
    def insertx(self,p,key,avl): # replaceを呼ぶために一つ上の親を持っているinsert
        if key < avl[1]:
            if avl[0] == None:
                avl[0] = self.node(key)
            else:
                if not self.insertx(avl,key,avl[0]): # 左の木が生長しなければ、
                    return False # 成長しない
            balance = avl[3]
            if balance == 2:
                avl[3] = 0
                return False
            elif balance == 0:
                avl[3] = 1
                return True # 成長した
            elif balance == 1:
                if avl[0][3] == 2:
                    self.replace(p,self.DoubleRightRotation(avl),avl)
                elif self.left.balance == 1:
                    self.replace(p,self.SingleRightRotation(avl),avl)
                return False # rotationを行うと成長しない
        if avl[1] < key:
            if avl[2] == None:
                avl[2] = self.node(key)
            else:
                if not self.insertx(avl,key,avl[2]):
                    return False
            balance = avl[3]
            if balance == 1:
                avl[3] = 0
                return False
            elif balance == 0:
                avl[3] = 2
                return True
            elif balance == 2:
                if avl[2][3] == 1:
                    self.replace(p,self.DoubleLeftRotation(avl),avl)
                elif avl[2][3] == 2:
                    self.replace(p,self.SingleLeftRotation(avl),avl)
                return False
        return False # avl[1] == keyの時は何もしないので成長もしない

    def debug(self):
        print((self.avl))

def main():
    a, b, q = list(map(int,input().split()))
    treeA, treeB = AvlTree(), AvlTree()
    INF = 10**12
    for _ in range(a): treeA.insert(int(eval(input())))
    for _ in range(b): treeB.insert(int(eval(input())))
    for _ in range(q):
        i = int(eval(input()))
        p1,p2 = 0, 0
        alow = treeA.search_lower(i)
        ahigh = treeA.search_higher(i)
        p1 = abs(alow-i) if alow else INF
        p2 = abs(ahigh-i) if ahigh else INF
        if alow:
            add = INF
            if treeB.search_lower(alow):
                add = min(abs(treeB.search_lower(alow)-alow),add)
            if treeB.search_higher(alow):
                add = min(abs(treeB.search_higher(alow)-alow),add)
            p1 += add
        if ahigh:
            add = INF
            if treeB.search_lower(ahigh):
                add = min(abs(treeB.search_lower(ahigh)-ahigh),add)
            if treeB.search_higher(ahigh):
                add = min(abs(treeB.search_higher(ahigh)-ahigh),add)
            p2 += add
        ans = min(p1,p2)
        # btoa
        p3,p4 = 0, 0
        blow = treeB.search_lower(i)
        bhigh = treeB.search_higher(i)
        p3 = abs(blow-i) if blow else INF
        p4 = abs(bhigh-i) if bhigh else INF
        if blow:
            add = INF
            if treeA.search_lower(blow):
                add = min(abs(treeA.search_lower(blow)-blow),add)
            if treeA.search_higher(blow):
                add = min(abs(treeA.search_higher(blow)-blow),add)
            p3 += add
        if bhigh:
            add = INF
            if treeA.search_lower(bhigh):
                add = min(abs(treeA.search_lower(bhigh)-bhigh),add)
            if treeA.search_higher(bhigh):
                add = min(abs(treeA.search_higher(bhigh)-bhigh),add)
            p4 += add
        ans = min(p3,p4,ans)
        print(ans)

if __name__ == "__main__":
    main()

# Optimized solution
import bisect

A, B, Q = list(map(int,input().split()))
INF = 10**18
s = [-INF] + [int(eval(input())) for i in range(A)] + [INF]
t = [-INF] + [int(eval(input())) for i in range(B)] + [INF]
x = [int(eval(input())) for i in range(Q)]

for e in x:
    b, d = bisect.bisect_right(s,e), bisect.bisect_right(t,e)
    a, c = b-1, d-1
    ans = INF
    for S in [s[a],s[b]]:
        for T in [t[c],t[d]]:
            d1, d2 = abs(S-e) + abs(T-S), abs(T-e) + abs(S-T)
            ans = min(ans, d1, d2)
    print(ans)