def is_not_less_than(ls, ind, key):
    if ls[ind] >= key:
        return True
    else:
        return False
def return_min_ind_whose_value_not_less_than(ls,key):
    r = len(ls)
    l = -1
    while True:
        next_ind = (r+l) // 2
        if is_not_less_than(ls, next_ind, key):
            r = next_ind
        else:
            l = next_ind
        if r - l == 1:
            return r
n_shrine,n_temple,Q = map(int,input().split())
shrine_ls = [0] * (n_shrine+1)
temple_ls = [0] * (n_temple+1)
Q_ls = [0] * Q
for i in range(n_shrine):
    shrine_ls[i] = int(input())
shrine_ls[-1] = float('inf')
for i in range(n_temple):
    temple_ls[i] = int(input())
temple_ls[-1] = float('inf')
for i in range(Q):
    Q_ls[i] = int(input())

for q in Q_ls:
    i_Rshrine = return_min_ind_whose_value_not_less_than(shrine_ls,q)
    Rshrine = shrine_ls[i_Rshrine]
    i_Lshrine = i_Rshrine-1
    Lshrine = shrine_ls[i_Lshrine]

    i_Rtemple = return_min_ind_whose_value_not_less_than(temple_ls,q)
    Rtemple = temple_ls[i_Rtemple]
    i_Ltemple = i_Rtemple-1
    Ltemple = temple_ls[i_Ltemple]
    # Temple,Shrine共に右
    RR = max(Rtemple,Rshrine) - q
    # Temple,Shrine共に左
    if i_Lshrine >= 0 and i_Ltemple >= 0:
        LL = abs(min(Ltemple,Lshrine)-q)
    else:
        LL = float('inf')
    #右templeと左shrine
    if i_Lshrine >= 0:
        RtLs = 2*min(Rtemple-q,q-Lshrine) + max(Rtemple-q,q-Lshrine)
    else:
        RtLs = float('inf')
    # 左templeと右shrine
    if i_Ltemple >= 0:
        LtRs = 2*min(Rshrine-q,q-Ltemple) + max(Rshrine-q,q-Ltemple)
    else:
        LtRs = float('inf')

    print(min(LL,RR,RtLs,LtRs))
 def is_not_less_than(ls, ind, key):
    if ls[ind] >= key:
        return True
    else:
        return False is_not_less_than if ls[ind] >= key:
        return True
    else:
        return False ls[ind] >= key ls[ind] ls ind key return True True return False False ls ls ind ind key key def return_min_ind_whose_value_not_less_than(ls,key):
    r = len(ls)
    l = -1
    while True:
        next_ind = (r+l) // 2
        if is_not_less_than(ls, next_ind, key):
            r = next_ind
        else:
            l = next_ind
        if r - l == 1:
            return r return_min_ind_whose_value_not_less_than r = len(ls) r len(ls) len ls l = -1 l -1 while True:
        next_ind = (r+l) // 2
        if is_not_less_than(ls, next_ind, key):
            r = next_ind
        else:
            l = next_ind
        if r - l == 1:
            return r True next_ind = (r+l) // 2 next_ind (r+l) // 2 r+l r l 2 if is_not_less_than(ls, next_ind, key):
            r = next_ind
        else:
            l = next_ind
         is_not_less_than(ls, next_ind, key) is_not_less_than ls next_ind key r = next_ind r next_ind l = next_ind l next_ind if r - l == 1:
            return r r - l == 1 r - l r l 1 return r r ls ls key key n_shrine,n_temple,Q = map(int,input().split()) n_shrine map(int,input().split()) map int input().split() ().split () input split n_temple Q shrine_ls = [0] * (n_shrine+1) shrine_ls [0] * (n_shrine+1) [0] 0 n_shrine+1 n_shrine 1 temple_ls = [0] * (n_temple+1) temple_ls [0] * (n_temple+1) [0] 0 n_temple+1 n_temple 1 Q_ls = [0] * Q Q_ls [0] * Q [0] 0 Q for i in range(n_shrine):
    shrine_ls[i] = int(input()) i range(n_shrine) range n_shrine shrine_ls[i] = int(input()) shrine_ls[i] shrine_ls i int(input()) int input() input shrine_ls[-1] = float('inf') shrine_ls[-1] shrine_ls -1 float('inf') float 'inf' for i in range(n_temple):
    temple_ls[i] = int(input()) i range(n_temple) range n_temple temple_ls[i] = int(input()) temple_ls[i] temple_ls i int(input()) int input() input temple_ls[-1] = float('inf') temple_ls[-1] temple_ls -1 float('inf') float 'inf' for i in range(Q):
    Q_ls[i] = int(input()) i range(Q) range Q Q_ls[i] = int(input()) Q_ls[i] Q_ls i int(input()) int input() input for q in Q_ls:
    i_Rshrine = return_min_ind_whose_value_not_less_than(shrine_ls,q)
    Rshrine = shrine_ls[i_Rshrine]
    i_Lshrine = i_Rshrine-1
    Lshrine = shrine_ls[i_Lshrine]

    i_Rtemple = return_min_ind_whose_value_not_less_than(temple_ls,q)
    Rtemple = temple_ls[i_Rtemple]
    i_Ltemple = i_Rtemple-1
    Ltemple = temple_ls[i_Ltemple]
    # Temple,Shrine共に右
    RR = max(Rtemple,Rshrine) - q
    # Temple,Shrine共に左
    if i_Lshrine >= 0 and i_Ltemple >= 0:
        LL = abs(min(Ltemple,Lshrine)-q)
    else:
        LL = float('inf')
    #右templeと左shrine
    if i_Lshrine >= 0:
        RtLs = 2*min(Rtemple-q,q-Lshrine) + max(Rtemple-q,q-Lshrine)
    else:
        RtLs = float('inf')
    # 左templeと右shrine
    if i_Ltemple >= 0:
        LtRs = 2*min(Rshrine-q,q-Ltemple) + max(Rshrine-q,q-Ltemple)
    else:
        LtRs = float('inf')

    print(min(LL,RR,RtLs,LtRs)) q Q_ls i_Rshrine = return_min_ind_whose_value_not_less_than(shrine_ls,q) i_Rshrine return_min_ind_whose_value_not_less_than(shrine_ls,q) return_min_ind_whose_value_not_less_than shrine_ls q Rshrine = shrine_ls[i_Rshrine] Rshrine shrine_ls[i_Rshrine] shrine_ls i_Rshrine i_Lshrine = i_Rshrine-1 i_Lshrine i_Rshrine-1 i_Rshrine 1 Lshrine = shrine_ls[i_Lshrine] Lshrine shrine_ls[i_Lshrine] shrine_ls i_Lshrine i_Rtemple = return_min_ind_whose_value_not_less_than(temple_ls,q) i_Rtemple return_min_ind_whose_value_not_less_than(temple_ls,q) return_min_ind_whose_value_not_less_than temple_ls q Rtemple = temple_ls[i_Rtemple] Rtemple temple_ls[i_Rtemple] temple_ls i_Rtemple i_Ltemple = i_Rtemple-1 i_Ltemple i_Rtemple-1 i_Rtemple 1 Ltemple = temple_ls[i_Ltemple] Ltemple temple_ls[i_Ltemple] temple_ls i_Ltemple RR = max(Rtemple,Rshrine) - q RR max(Rtemple,Rshrine) - q max(Rtemple,Rshrine) max Rtemple Rshrine q if i_Lshrine >= 0 and i_Ltemple >= 0:
        LL = abs(min(Ltemple,Lshrine)-q)
    else:
        LL = float('inf')
    #右templeと左shrine
     i_Lshrine >= 0 and i_Ltemple >= 0 i_Lshrine >= 0 i_Lshrine 0 i_Ltemple >= 0 i_Ltemple 0 LL = abs(min(Ltemple,Lshrine)-q) LL abs(min(Ltemple,Lshrine)-q) abs min(Ltemple,Lshrine)-q min(Ltemple,Lshrine) min Ltemple Lshrine q LL = float('inf') LL float('inf') float 'inf' if i_Lshrine >= 0:
        RtLs = 2*min(Rtemple-q,q-Lshrine) + max(Rtemple-q,q-Lshrine)
    else:
        RtLs = float('inf')
    # 左templeと右shrine
     i_Lshrine >= 0 i_Lshrine 0 RtLs = 2*min(Rtemple-q,q-Lshrine) + max(Rtemple-q,q-Lshrine) RtLs 2*min(Rtemple-q,q-Lshrine) + max(Rtemple-q,q-Lshrine) 2*min(Rtemple-q,q-Lshrine) 2 min(Rtemple-q,q-Lshrine) min Rtemple-q Rtemple q q-Lshrine q Lshrine max(Rtemple-q,q-Lshrine) max Rtemple-q Rtemple q q-Lshrine q Lshrine RtLs = float('inf') RtLs float('inf') float 'inf' if i_Ltemple >= 0:
        LtRs = 2*min(Rshrine-q,q-Ltemple) + max(Rshrine-q,q-Ltemple)
    else:
        LtRs = float('inf')

     i_Ltemple >= 0 i_Ltemple 0 LtRs = 2*min(Rshrine-q,q-Ltemple) + max(Rshrine-q,q-Ltemple) LtRs 2*min(Rshrine-q,q-Ltemple) + max(Rshrine-q,q-Ltemple) 2*min(Rshrine-q,q-Ltemple) 2 min(Rshrine-q,q-Ltemple) min Rshrine-q Rshrine q q-Ltemple q Ltemple max(Rshrine-q,q-Ltemple) max Rshrine-q Rshrine q q-Ltemple q Ltemple LtRs = float('inf') LtRs float('inf') float 'inf' print(min(LL,RR,RtLs,LtRs)) print min(LL,RR,RtLs,LtRs) min LL RR RtLs LtRs LtRs = float('inf') float('inf') LtRs i_Rshrine = return_min_ind_whose_value_not_less_than(shrine_ls,q) return_min_ind_whose_value_not_less_than(shrine_ls,q) i_Rshrine n_shrine,n_temple,Q = map(int,input().split()) map(int,input().split()) n_shrine LL = abs(min(Ltemple,Lshrine)-q) abs(min(Ltemple,Lshrine)-q) LL temple_ls = [0] * (n_temple+1) [0] * (n_temple+1) temple_ls Rtemple = temple_ls[i_Rtemple] temple_ls[i_Rtemple] Rtemple n_temple,Q = map(int,input().split()) map(int,input().split()) n_temple LtRs = 2*min(Rshrine-q,q-Ltemple) + max(Rshrine-q,q-Ltemple) 2*min(Rshrine-q,q-Ltemple) + max(Rshrine-q,q-Ltemple) LtRs Lshrine = shrine_ls[i_Lshrine] shrine_ls[i_Lshrine] Lshrine RR = max(Rtemple,Rshrine) - q max(Rtemple,Rshrine) - q RR i_Ltemple = i_Rtemple-1 i_Rtemple-1 i_Ltemple RtLs = 2*min(Rtemple-q,q-Lshrine) + max(Rtemple-q,q-Lshrine) 2*min(Rtemple-q,q-Lshrine) + max(Rtemple-q,q-Lshrine) RtLs def return_min_ind_whose_value_not_less_than(ls,key):
    r = len(ls)
    l = -1
    while True:
        next_ind = (r+l) // 2
        if is_not_less_than(ls, next_ind, key):
            r = next_ind
        else:
            l = next_ind
        if r - l == 1:
            return r def return_min_ind_whose_value_not_less_than(ls,key):
    r = len(ls)
    l = -1
    while True:
        next_ind = (r+l) // 2
        if is_not_less_than(ls, next_ind, key):
            r = next_ind
        else:
            l = next_ind
        if r - l == 1:
            return r return_min_ind_whose_value_not_less_than i_Rtemple = return_min_ind_whose_value_not_less_than(temple_ls,q) return_min_ind_whose_value_not_less_than(temple_ls,q) i_Rtemple RtLs = float('inf') float('inf') RtLs Q = map(int,input().split()) map(int,input().split()) Q Q_ls = [0] * Q [0] * Q Q_ls LL = float('inf') float('inf') LL def is_not_less_than(ls, ind, key):
    if ls[ind] >= key:
        return True
    else:
        return False def is_not_less_than(ls, ind, key):
    if ls[ind] >= key:
        return True
    else:
        return False is_not_less_than shrine_ls = [0] * (n_shrine+1) [0] * (n_shrine+1) shrine_ls i_Lshrine = i_Rshrine-1 i_Rshrine-1 i_Lshrine Ltemple = temple_ls[i_Ltemple] temple_ls[i_Ltemple] Ltemple Rshrine = shrine_ls[i_Rshrine] shrine_ls[i_Rshrine] Rshrine
def is_not_less_than(ls, ind, key):
    if ls[ind] >= key:
        return True
    else:
        return False
def return_min_ind_whose_value_not_less_than(ls,key):
    r = len(ls)
    l = -1
    while True:
        next_ind = (r+l) // 2
        if is_not_less_than(ls, next_ind, key):
            r = next_ind
        else:
            l = next_ind
        if r - l == 1:
            return r
n_shrine,n_temple,Q = map(int,input().split())
shrine_ls = [0] * (n_shrine+1)
temple_ls = [0] * (n_temple+1)
Q_ls = [0] * Q
for i in range(n_shrine):
    shrine_ls[i] = int(input())
shrine_ls[-1] = float('inf')
for i in range(n_temple):
    temple_ls[i] = int(input())
temple_ls[-1] = float('inf')
for i in range(Q):
    Q_ls[i] = int(input())

for q in Q_ls:
    i_Rshrine = return_min_ind_whose_value_not_less_than(shrine_ls,q)
    Rshrine = shrine_ls[i_Rshrine]
    i_Lshrine = i_Rshrine-1
    Lshrine = shrine_ls[i_Lshrine]

    i_Rtemple = return_min_ind_whose_value_not_less_than(temple_ls,q)
    Rtemple = temple_ls[i_Rtemple]
    i_Ltemple = i_Rtemple-1
    Ltemple = temple_ls[i_Ltemple]
    # Temple,Shrine共に右
    RR = max(Rtemple,Rshrine) - q
    # Temple,Shrine共に左
    if i_Lshrine >= 0 and i_Ltemple >= 0:
        LL = abs(min(Ltemple,Lshrine)-q)
    else:
        LL = float('inf')
    #右templeと左shrine
    if i_Lshrine >= 0:
        RtLs = 2*min(Rtemple-q,q-Lshrine) + max(Rtemple-q,q-Lshrine)
    else:
        RtLs = float('inf')
    # 左templeと右shrine
    if i_Ltemple >= 0:
        LtRs = 2*min(Rshrine-q,q-Ltemple) + max(Rshrine-q,q-Ltemple)
    else:
        LtRs = float('inf')

    print(min(LL,RR,RtLs,LtRs))

