import bisect

A,B,Q = map(int,input().split())

shira = [-100000000000] + [int(input()) for _ in range(A)] + [10000000000000]
temp = [-100000000000] + [int(input()) for _ in range(B)] + [10000000000000]

shira.sort()
temp.sort()

for _ in range(Q):
    x = int(input())
    shira_s = bisect.bisect_left(shira,x)
    temp_s = bisect.bisect_left(temp,x)
    ans = 100000000000
    for i in [shira_s-1,shira_s]:
        for j in [temp_s-1,temp_s]:
            ans = min(ans, abs(shira[i]-x)+abs(shira[i]-temp[j]))
            ans = min(ans, abs(temp[j]-x)+abs(temp[j]-shira[i]))
    print(ans) import bisect bisect 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 shira = [-100000000000] + [int(input()) for _ in range(A)] + [10000000000000] shira [-100000000000] + [int(input()) for _ in range(A)] + [10000000000000] [-100000000000] + [int(input()) for _ in range(A)] [-100000000000] -100000000000 [int(input()) for _ in range(A)] [10000000000000] 10000000000000 int(input()) for _ in range(B) for _ in range(B) _ range(B) range B for _ in range(B) int(input()) int input() input temp = [-100000000000] + [int(input()) for _ in range(B)] + [10000000000000] temp [-100000000000] + [int(input()) for _ in range(B)] + [10000000000000] [-100000000000] + [int(input()) for _ in range(B)] [-100000000000] -100000000000 [int(input()) for _ in range(B)] [10000000000000] 10000000000000 shira.sort() shira.sort shira sort temp.sort() temp.sort temp sort for _ in range(Q):
    x = int(input())
    shira_s = bisect.bisect_left(shira,x)
    temp_s = bisect.bisect_left(temp,x)
    ans = 100000000000
    for i in [shira_s-1,shira_s]:
        for j in [temp_s-1,temp_s]:
            ans = min(ans, abs(shira[i]-x)+abs(shira[i]-temp[j]))
            ans = min(ans, abs(temp[j]-x)+abs(temp[j]-shira[i]))
    print(ans) _ range(Q) range Q x = int(input()) x int(input()) int input() input shira_s = bisect.bisect_left(shira,x) shira_s bisect.bisect_left(shira,x) bisect.bisect_left bisect bisect_left shira x temp_s = bisect.bisect_left(temp,x) temp_s bisect.bisect_left(temp,x) bisect.bisect_left bisect bisect_left temp x ans = 100000000000 ans 100000000000 for i in [shira_s-1,shira_s]:
        for j in [temp_s-1,temp_s]:
            ans = min(ans, abs(shira[i]-x)+abs(shira[i]-temp[j]))
            ans = min(ans, abs(temp[j]-x)+abs(temp[j]-shira[i]))
     i [shira_s-1,shira_s] shira_s-1 shira_s 1 shira_s for j in [temp_s-1,temp_s]:
            ans = min(ans, abs(shira[i]-x)+abs(shira[i]-temp[j]))
            ans = min(ans, abs(temp[j]-x)+abs(temp[j]-shira[i]))
     j [temp_s-1,temp_s] temp_s-1 temp_s 1 temp_s ans = min(ans, abs(shira[i]-x)+abs(shira[i]-temp[j])) ans min(ans, abs(shira[i]-x)+abs(shira[i]-temp[j])) min ans abs(shira[i]-x)+abs(shira[i]-temp[j]) abs(shira[i]-x) abs shira[i]-x shira[i] shira i x abs(shira[i]-temp[j]) abs shira[i]-temp[j] shira[i] shira i temp[j] temp j ans = min(ans, abs(temp[j]-x)+abs(temp[j]-shira[i])) ans min(ans, abs(temp[j]-x)+abs(temp[j]-shira[i])) min ans abs(temp[j]-x)+abs(temp[j]-shira[i]) abs(temp[j]-x) abs temp[j]-x temp[j] temp j x abs(temp[j]-shira[i]) abs temp[j]-shira[i] temp[j] temp j shira[i] shira i print(ans) print ans x = int(input()) int(input()) x A,B,Q = map(int,input().split()) map(int,input().split()) A ans = min(ans, abs(temp[j]-x)+abs(temp[j]-shira[i])) min(ans, abs(temp[j]-x)+abs(temp[j]-shira[i])) ans ans = min(ans, abs(shira[i]-x)+abs(shira[i]-temp[j])) min(ans, abs(shira[i]-x)+abs(shira[i]-temp[j])) ans temp = [-100000000000] + [int(input()) for _ in range(B)] + [10000000000000] [-100000000000] + [int(input()) for _ in range(B)] + [10000000000000] temp ans = 100000000000 100000000000 ans Q = map(int,input().split()) map(int,input().split()) Q temp_s = bisect.bisect_left(temp,x) bisect.bisect_left(temp,x) temp_s B,Q = map(int,input().split()) map(int,input().split()) B shira = [-100000000000] + [int(input()) for _ in range(A)] + [10000000000000] [-100000000000] + [int(input()) for _ in range(A)] + [10000000000000] shira shira_s = bisect.bisect_left(shira,x) bisect.bisect_left(shira,x) shira_s
import bisect

A,B,Q = map(int,input().split())

shira = [-100000000000] + [int(input()) for _ in range(A)] + [10000000000000]
temp = [-100000000000] + [int(input()) for _ in range(B)] + [10000000000000]

shira.sort()
temp.sort()

for _ in range(Q):
    x = int(input())
    shira_s = bisect.bisect_left(shira,x)
    temp_s = bisect.bisect_left(temp,x)
    ans = 100000000000
    for i in [shira_s-1,shira_s]:
        for j in [temp_s-1,temp_s]:
            ans = min(ans, abs(shira[i]-x)+abs(shira[i]-temp[j]))
            ans = min(ans, abs(temp[j]-x)+abs(temp[j]-shira[i]))
    print(ans)