import sys
input = sys.stdin.readline
INF = 10**11
A,B,Q = map(int,input().split())
s = [-INF] + [int(input()) for _ in range(A)] + [INF]
t = [-INF] + [int(input()) for _ in range(B)] + [INF]
def binary_search(lis,x):
    ok = 0
    ng = len(lis)-1
    while ng-ok > 1:
        mid = (ok+ng)//2
        if lis[mid] < x:
            ok = mid
        else:
            ng = mid
    return ok
#print(s,t)
for _ in range(Q):
    x = int(input())
    ps = binary_search(s,x)
    pt = binary_search(t,x)
    ans = INF
    #print(ps,pt)
    for i in range(ps,ps+2):
        for j in range(pt,pt+2):
            ds = x - s[i]
            dt = x - t[j]
            
            if (ds < 0 and dt < 0) or (ds > 0 and dt > 0):
                ans = min(ans,max(abs(ds),abs(dt)))
            else:
                ans = min(ans,abs(ds)+abs(dt)+min(abs(ds),abs(dt)))
    print(ans)  
             import sys sys input = sys.stdin.readline input sys.stdin.readline sys.stdin sys stdin readline INF = 10**11 INF 10**11 10 11 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 = [-INF] + [int(input()) for _ in range(A)] + [INF] s [-INF] + [int(input()) for _ in range(A)] + [INF] [-INF] + [int(input()) for _ in range(A)] [-INF] -INF INF [int(input()) for _ in range(A)] [INF] INF int(input()) for _ in range(B) for _ in range(B) _ range(B) range B for _ in range(B) int(input()) int input() input t = [-INF] + [int(input()) for _ in range(B)] + [INF] t [-INF] + [int(input()) for _ in range(B)] + [INF] [-INF] + [int(input()) for _ in range(B)] [-INF] -INF INF [int(input()) for _ in range(B)] [INF] INF def binary_search(lis,x):
    ok = 0
    ng = len(lis)-1
    while ng-ok > 1:
        mid = (ok+ng)//2
        if lis[mid] < x:
            ok = mid
        else:
            ng = mid
    return ok
#print(s,t) binary_search ok = 0 ok 0 ng = len(lis)-1 ng len(lis)-1 len(lis) len lis 1 while ng-ok > 1:
        mid = (ok+ng)//2
        if lis[mid] < x:
            ok = mid
        else:
            ng = mid
     ng-ok > 1 ng-ok ng ok 1 mid = (ok+ng)//2 mid (ok+ng)//2 ok+ng ok ng 2 if lis[mid] < x:
            ok = mid
        else:
            ng = mid
     lis[mid] < x lis[mid] lis mid x ok = mid ok mid ng = mid ng mid return ok ok lis lis x x for _ in range(Q):
    x = int(input())
    ps = binary_search(s,x)
    pt = binary_search(t,x)
    ans = INF
    #print(ps,pt)
    for i in range(ps,ps+2):
        for j in range(pt,pt+2):
            ds = x - s[i]
            dt = x - t[j]
            
            if (ds < 0 and dt < 0) or (ds > 0 and dt > 0):
                ans = min(ans,max(abs(ds),abs(dt)))
            else:
                ans = min(ans,abs(ds)+abs(dt)+min(abs(ds),abs(dt)))
    print(ans)  
             _ range(Q) range Q x = int(input()) x int(input()) int input() input ps = binary_search(s,x) ps binary_search(s,x) binary_search s x pt = binary_search(t,x) pt binary_search(t,x) binary_search t x ans = INF ans INF for i in range(ps,ps+2):
        for j in range(pt,pt+2):
            ds = x - s[i]
            dt = x - t[j]
            
            if (ds < 0 and dt < 0) or (ds > 0 and dt > 0):
                ans = min(ans,max(abs(ds),abs(dt)))
            else:
                ans = min(ans,abs(ds)+abs(dt)+min(abs(ds),abs(dt)))
     i range(ps,ps+2) range ps ps+2 ps 2 for j in range(pt,pt+2):
            ds = x - s[i]
            dt = x - t[j]
            
            if (ds < 0 and dt < 0) or (ds > 0 and dt > 0):
                ans = min(ans,max(abs(ds),abs(dt)))
            else:
                ans = min(ans,abs(ds)+abs(dt)+min(abs(ds),abs(dt)))
     j range(pt,pt+2) range pt pt+2 pt 2 ds = x - s[i] ds x - s[i] x s[i] s i dt = x - t[j] dt x - t[j] x t[j] t j if (ds < 0 and dt < 0) or (ds > 0 and dt > 0):
                ans = min(ans,max(abs(ds),abs(dt)))
            else:
                ans = min(ans,abs(ds)+abs(dt)+min(abs(ds),abs(dt)))
     (ds < 0 and dt < 0) or (ds > 0 and dt > 0) ds < 0 and dt < 0 ds < 0 ds 0 dt < 0 dt 0 ds > 0 and dt > 0 ds > 0 ds 0 dt > 0 dt 0 ans = min(ans,max(abs(ds),abs(dt))) ans min(ans,max(abs(ds),abs(dt))) min ans max(abs(ds),abs(dt)) max abs(ds) abs ds abs(dt) abs dt ans = min(ans,abs(ds)+abs(dt)+min(abs(ds),abs(dt))) ans min(ans,abs(ds)+abs(dt)+min(abs(ds),abs(dt))) min ans abs(ds)+abs(dt)+min(abs(ds),abs(dt)) abs(ds)+abs(dt) abs(ds) abs ds abs(dt) abs dt min(abs(ds),abs(dt)) min abs(ds) abs ds abs(dt) abs dt print(ans) print ans pt = binary_search(t,x) binary_search(t,x) pt def binary_search(lis,x):
    ok = 0
    ng = len(lis)-1
    while ng-ok > 1:
        mid = (ok+ng)//2
        if lis[mid] < x:
            ok = mid
        else:
            ng = mid
    return ok
#print(s,t) def binary_search(lis,x):
    ok = 0
    ng = len(lis)-1
    while ng-ok > 1:
        mid = (ok+ng)//2
        if lis[mid] < x:
            ok = mid
        else:
            ng = mid
    return ok
#print(s,t) binary_search Q = map(int,input().split()) map(int,input().split()) Q input = sys.stdin.readline sys.stdin.readline input x = int(input()) int(input()) x ans = min(ans,max(abs(ds),abs(dt))) min(ans,max(abs(ds),abs(dt))) ans INF = 10**11 10**11 INF ans = INF INF ans A,B,Q = map(int,input().split()) map(int,input().split()) A ans = min(ans,abs(ds)+abs(dt)+min(abs(ds),abs(dt))) min(ans,abs(ds)+abs(dt)+min(abs(ds),abs(dt))) ans B,Q = map(int,input().split()) map(int,input().split()) B t = [-INF] + [int(input()) for _ in range(B)] + [INF] [-INF] + [int(input()) for _ in range(B)] + [INF] t s = [-INF] + [int(input()) for _ in range(A)] + [INF] [-INF] + [int(input()) for _ in range(A)] + [INF] s ds = x - s[i] x - s[i] ds dt = x - t[j] x - t[j] dt ps = binary_search(s,x) binary_search(s,x) ps
import sys
input = sys.stdin.readline
INF = 10**11
A,B,Q = map(int,input().split())
s = [-INF] + [int(input()) for _ in range(A)] + [INF]
t = [-INF] + [int(input()) for _ in range(B)] + [INF]
def binary_search(lis,x):
    ok = 0
    ng = len(lis)-1
    while ng-ok > 1:
        mid = (ok+ng)//2
        if lis[mid] < x:
            ok = mid
        else:
            ng = mid
    return ok
#print(s,t)
for _ in range(Q):
    x = int(input())
    ps = binary_search(s,x)
    pt = binary_search(t,x)
    ans = INF
    #print(ps,pt)
    for i in range(ps,ps+2):
        for j in range(pt,pt+2):
            ds = x - s[i]
            dt = x - t[j]
            
            if (ds < 0 and dt < 0) or (ds > 0 and dt > 0):
                ans = min(ans,max(abs(ds),abs(dt)))
            else:
                ans = min(ans,abs(ds)+abs(dt)+min(abs(ds),abs(dt)))
    print(ans)  
            
