# 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):
            ans = min(ans,abs(s[i]-x)+abs(s[i]-t[j]), abs(t[j]-x)+abs(t[j]-s[i]))
    print(ans)  
             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):
            ans = min(ans,abs(s[i]-x)+abs(s[i]-t[j]), abs(t[j]-x)+abs(t[j]-s[i]))
    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):
            ans = min(ans,abs(s[i]-x)+abs(s[i]-t[j]), abs(t[j]-x)+abs(t[j]-s[i]))
     i range(ps,ps+2) range ps ps+2 ps 2 for j in range(pt,pt+2):
            ans = min(ans,abs(s[i]-x)+abs(s[i]-t[j]), abs(t[j]-x)+abs(t[j]-s[i]))
     j range(pt,pt+2) range pt pt+2 pt 2 ans = min(ans,abs(s[i]-x)+abs(s[i]-t[j]), abs(t[j]-x)+abs(t[j]-s[i])) ans min(ans,abs(s[i]-x)+abs(s[i]-t[j]), abs(t[j]-x)+abs(t[j]-s[i])) min ans abs(s[i]-x)+abs(s[i]-t[j]) abs(s[i]-x) abs s[i]-x s[i] s i x abs(s[i]-t[j]) abs s[i]-t[j] s[i] s i t[j] t j abs(t[j]-x)+abs(t[j]-s[i]) abs(t[j]-x) abs t[j]-x t[j] t j x abs(t[j]-s[i]) abs t[j]-s[i] t[j] t j s[i] s i print(ans) print ans ans = min(ans,abs(s[i]-x)+abs(s[i]-t[j]), abs(t[j]-x)+abs(t[j]-s[i])) min(ans,abs(s[i]-x)+abs(s[i]-t[j]), abs(t[j]-x)+abs(t[j]-s[i])) ans s = [-INF] + [int(input()) for _ in range(A)] + [INF] [-INF] + [int(input()) for _ in range(A)] + [INF] s t = [-INF] + [int(input()) for _ in range(B)] + [INF] [-INF] + [int(input()) for _ in range(B)] + [INF] t pt = binary_search(t,x) binary_search(t,x) pt ans = INF INF ans B,Q = map(int,input().split()) map(int,input().split()) B 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 A,B,Q = map(int,input().split()) map(int,input().split()) A ps = binary_search(s,x) binary_search(s,x) ps INF = 10**11 10**11 INF Q = map(int,input().split()) map(int,input().split()) Q x = int(input()) int(input()) x
# 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):
            ans = min(ans,abs(s[i]-x)+abs(s[i]-t[j]), abs(t[j]-x)+abs(t[j]-s[i]))
    print(ans)  
            
