from bisect import *
A,B,Q=map(int,input().split())
s=[int(input()) for _ in range(A)]
t=[int(input()) for _ in range(B)]
x=[int(input()) for _ in range(Q)]
#print(s,t,x)
for i in x:
    ans=float("inf")
    mins=-float("inf")
    mint=-float("inf")
    maxs=float("inf")
    maxt=float("inf")
    sind=bisect(s,i)
    tind=bisect(t,i)

    if sind!=0:
        mins=s[sind-1]
    if tind!=0:
        mint=t[tind-1]
    if sind!=len(s):
        maxs=s[sind]
    if tind!=len(t):
        maxt=t[tind]
    #print(mins,maxs,mint,maxt)
    slist=[mins,maxs]
    tlist=[mint,maxt]
    ans=min(ans,abs(i-mins)+abs(mins-mint))
    ans=min(ans,abs(i-mins)+abs(mins-maxt))
    ans=min(ans,abs(i-maxs)+abs(maxs-mint))
    ans=min(ans,abs(i-maxs)+abs(maxs-maxt))
    ans=min(ans,abs(i-mint)+abs(mint-mins))
    ans=min(ans,abs(i-mint)+abs(mint-maxs))
    ans=min(ans,abs(i-maxt)+abs(maxt-mins))
    ans=min(ans,abs(i-maxt)+abs(maxt-maxs))
    print(ans)



 from bisect import * A,B,Q=map(int,input().split()) A map(int,input().split()) map int input().split() ().split () input split B Q int(input()) for _ in range(A) for _ in range(A) _ range(A) range A for _ in range(A) int(input()) int input() input s=[int(input()) for _ in range(A)] s [int(input()) for _ in range(A)] int(input()) for _ in range(B) for _ in range(B) _ range(B) range B for _ in range(B) int(input()) int input() input t=[int(input()) for _ in range(B)] t [int(input()) for _ in range(B)] int(input()) for _ in range(Q) for _ in range(Q) _ range(Q) range Q for _ in range(Q) int(input()) int input() input x=[int(input()) for _ in range(Q)] x [int(input()) for _ in range(Q)] for i in x:
    ans=float("inf")
    mins=-float("inf")
    mint=-float("inf")
    maxs=float("inf")
    maxt=float("inf")
    sind=bisect(s,i)
    tind=bisect(t,i)

    if sind!=0:
        mins=s[sind-1]
    if tind!=0:
        mint=t[tind-1]
    if sind!=len(s):
        maxs=s[sind]
    if tind!=len(t):
        maxt=t[tind]
    #print(mins,maxs,mint,maxt)
    slist=[mins,maxs]
    tlist=[mint,maxt]
    ans=min(ans,abs(i-mins)+abs(mins-mint))
    ans=min(ans,abs(i-mins)+abs(mins-maxt))
    ans=min(ans,abs(i-maxs)+abs(maxs-mint))
    ans=min(ans,abs(i-maxs)+abs(maxs-maxt))
    ans=min(ans,abs(i-mint)+abs(mint-mins))
    ans=min(ans,abs(i-mint)+abs(mint-maxs))
    ans=min(ans,abs(i-maxt)+abs(maxt-mins))
    ans=min(ans,abs(i-maxt)+abs(maxt-maxs))
    print(ans) i x ans=float("inf") ans float("inf") float "inf" mins=-float("inf") mins -float("inf") float("inf") float "inf" mint=-float("inf") mint -float("inf") float("inf") float "inf" maxs=float("inf") maxs float("inf") float "inf" maxt=float("inf") maxt float("inf") float "inf" sind=bisect(s,i) sind bisect(s,i) bisect s i tind=bisect(t,i) tind bisect(t,i) bisect t i if sind!=0:
        mins=s[sind-1]
     sind!=0 sind 0 mins=s[sind-1] mins s[sind-1] s sind-1 sind 1 if tind!=0:
        mint=t[tind-1]
     tind!=0 tind 0 mint=t[tind-1] mint t[tind-1] t tind-1 tind 1 if sind!=len(s):
        maxs=s[sind]
     sind!=len(s) sind len(s) len s maxs=s[sind] maxs s[sind] s sind if tind!=len(t):
        maxt=t[tind]
    #print(mins,maxs,mint,maxt)
     tind!=len(t) tind len(t) len t maxt=t[tind] maxt t[tind] t tind slist=[mins,maxs] slist [mins,maxs] mins maxs tlist=[mint,maxt] tlist [mint,maxt] mint maxt ans=min(ans,abs(i-mins)+abs(mins-mint)) ans min(ans,abs(i-mins)+abs(mins-mint)) min ans abs(i-mins)+abs(mins-mint) abs(i-mins) abs i-mins i mins abs(mins-mint) abs mins-mint mins mint ans=min(ans,abs(i-mins)+abs(mins-maxt)) ans min(ans,abs(i-mins)+abs(mins-maxt)) min ans abs(i-mins)+abs(mins-maxt) abs(i-mins) abs i-mins i mins abs(mins-maxt) abs mins-maxt mins maxt ans=min(ans,abs(i-maxs)+abs(maxs-mint)) ans min(ans,abs(i-maxs)+abs(maxs-mint)) min ans abs(i-maxs)+abs(maxs-mint) abs(i-maxs) abs i-maxs i maxs abs(maxs-mint) abs maxs-mint maxs mint ans=min(ans,abs(i-maxs)+abs(maxs-maxt)) ans min(ans,abs(i-maxs)+abs(maxs-maxt)) min ans abs(i-maxs)+abs(maxs-maxt) abs(i-maxs) abs i-maxs i maxs abs(maxs-maxt) abs maxs-maxt maxs maxt ans=min(ans,abs(i-mint)+abs(mint-mins)) ans min(ans,abs(i-mint)+abs(mint-mins)) min ans abs(i-mint)+abs(mint-mins) abs(i-mint) abs i-mint i mint abs(mint-mins) abs mint-mins mint mins ans=min(ans,abs(i-mint)+abs(mint-maxs)) ans min(ans,abs(i-mint)+abs(mint-maxs)) min ans abs(i-mint)+abs(mint-maxs) abs(i-mint) abs i-mint i mint abs(mint-maxs) abs mint-maxs mint maxs ans=min(ans,abs(i-maxt)+abs(maxt-mins)) ans min(ans,abs(i-maxt)+abs(maxt-mins)) min ans abs(i-maxt)+abs(maxt-mins) abs(i-maxt) abs i-maxt i maxt abs(maxt-mins) abs maxt-mins maxt mins ans=min(ans,abs(i-maxt)+abs(maxt-maxs)) ans min(ans,abs(i-maxt)+abs(maxt-maxs)) min ans abs(i-maxt)+abs(maxt-maxs) abs(i-maxt) abs i-maxt i maxt abs(maxt-maxs) abs maxt-maxs maxt maxs print(ans) print ans mins=s[sind-1] s[sind-1] mins s=[int(input()) for _ in range(A)] [int(input()) for _ in range(A)] s ans=min(ans,abs(i-maxs)+abs(maxs-mint)) min(ans,abs(i-maxs)+abs(maxs-mint)) ans slist=[mins,maxs] [mins,maxs] slist maxs=s[sind] s[sind] maxs maxs=float("inf") float("inf") maxs A,B,Q=map(int,input().split()) map(int,input().split()) A sind=bisect(s,i) bisect(s,i) sind tind=bisect(t,i) bisect(t,i) tind tlist=[mint,maxt] [mint,maxt] tlist ans=min(ans,abs(i-maxs)+abs(maxs-maxt)) min(ans,abs(i-maxs)+abs(maxs-maxt)) ans ans=min(ans,abs(i-mint)+abs(mint-maxs)) min(ans,abs(i-mint)+abs(mint-maxs)) ans Q=map(int,input().split()) map(int,input().split()) Q x=[int(input()) for _ in range(Q)] [int(input()) for _ in range(Q)] x ans=min(ans,abs(i-maxt)+abs(maxt-mins)) min(ans,abs(i-maxt)+abs(maxt-mins)) ans ans=min(ans,abs(i-mins)+abs(mins-maxt)) min(ans,abs(i-mins)+abs(mins-maxt)) ans maxt=t[tind] t[tind] maxt maxt=float("inf") float("inf") maxt mint=-float("inf") -float("inf") mint ans=min(ans,abs(i-mins)+abs(mins-mint)) min(ans,abs(i-mins)+abs(mins-mint)) ans ans=min(ans,abs(i-mint)+abs(mint-mins)) min(ans,abs(i-mint)+abs(mint-mins)) ans mint=t[tind-1] t[tind-1] mint mins=-float("inf") -float("inf") mins ans=float("inf") float("inf") ans t=[int(input()) for _ in range(B)] [int(input()) for _ in range(B)] t ans=min(ans,abs(i-maxt)+abs(maxt-maxs)) min(ans,abs(i-maxt)+abs(maxt-maxs)) ans B,Q=map(int,input().split()) map(int,input().split()) B
from bisect import *
A,B,Q=map(int,input().split())
s=[int(input()) for _ in range(A)]
t=[int(input()) for _ in range(B)]
x=[int(input()) for _ in range(Q)]
#print(s,t,x)
for i in x:
    ans=float("inf")
    mins=-float("inf")
    mint=-float("inf")
    maxs=float("inf")
    maxt=float("inf")
    sind=bisect(s,i)
    tind=bisect(t,i)

    if sind!=0:
        mins=s[sind-1]
    if tind!=0:
        mint=t[tind-1]
    if sind!=len(s):
        maxs=s[sind]
    if tind!=len(t):
        maxt=t[tind]
    #print(mins,maxs,mint,maxt)
    slist=[mins,maxs]
    tlist=[mint,maxt]
    ans=min(ans,abs(i-mins)+abs(mins-mint))
    ans=min(ans,abs(i-mins)+abs(mins-maxt))
    ans=min(ans,abs(i-maxs)+abs(maxs-mint))
    ans=min(ans,abs(i-maxs)+abs(maxs-maxt))
    ans=min(ans,abs(i-mint)+abs(mint-mins))
    ans=min(ans,abs(i-mint)+abs(mint-maxs))
    ans=min(ans,abs(i-maxt)+abs(maxt-mins))
    ans=min(ans,abs(i-maxt)+abs(maxt-maxs))
    print(ans)




