from bisect import bisect
import sys
input = sys.stdin.readline

A, B, Q = map(int, input().split())
INF = float('inf')
s = [-INF] + [int(input()) for _ in range(A)] + [INF]
t = [-INF] + [int(input()) for _ in range(B)] + [INF]
for _ in range(Q):
    x = int(input())
    i = bisect(s, x)
    j = bisect(t, x)
    ans = INF
    for a in [s[i-1], s[i]]:
        for b in [t[j-1], t[j]]:
            ans = min(ans, abs(a-x)+abs(b-a), abs(b-x)+abs(a-b))
    print(ans) from bisect import bisect import sys sys input = sys.stdin.readline input sys.stdin.readline sys.stdin sys stdin readline A, B, Q = map(int, input().split()) A map(int, input().split()) map int input().split() ().split () input split B Q INF = float('inf') INF float('inf') float 'inf' 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 for _ in range(Q):
    x = int(input())
    i = bisect(s, x)
    j = bisect(t, x)
    ans = INF
    for a in [s[i-1], s[i]]:
        for b in [t[j-1], t[j]]:
            ans = min(ans, abs(a-x)+abs(b-a), abs(b-x)+abs(a-b))
    print(ans) _ range(Q) range Q x = int(input()) x int(input()) int input() input i = bisect(s, x) i bisect(s, x) bisect s x j = bisect(t, x) j bisect(t, x) bisect t x ans = INF ans INF for a in [s[i-1], s[i]]:
        for b in [t[j-1], t[j]]:
            ans = min(ans, abs(a-x)+abs(b-a), abs(b-x)+abs(a-b))
     a [s[i-1], s[i]] s[i-1] s i-1 i 1 s[i] s i for b in [t[j-1], t[j]]:
            ans = min(ans, abs(a-x)+abs(b-a), abs(b-x)+abs(a-b))
     b [t[j-1], t[j]] t[j-1] t j-1 j 1 t[j] t j ans = min(ans, abs(a-x)+abs(b-a), abs(b-x)+abs(a-b)) ans min(ans, abs(a-x)+abs(b-a), abs(b-x)+abs(a-b)) min ans abs(a-x)+abs(b-a) abs(a-x) abs a-x a x abs(b-a) abs b-a b a abs(b-x)+abs(a-b) abs(b-x) abs b-x b x abs(a-b) abs a-b a b print(ans) print ans x = int(input()) int(input()) x ans = min(ans, abs(a-x)+abs(b-a), abs(b-x)+abs(a-b)) min(ans, abs(a-x)+abs(b-a), abs(b-x)+abs(a-b)) ans input = sys.stdin.readline sys.stdin.readline input j = bisect(t, x) bisect(t, x) j B, Q = map(int, input().split()) map(int, input().split()) B A, B, Q = map(int, input().split()) map(int, input().split()) A t = [-INF] + [int(input()) for _ in range(B)] + [INF] [-INF] + [int(input()) for _ in range(B)] + [INF] t i = bisect(s, x) bisect(s, x) i ans = INF INF ans Q = map(int, input().split()) map(int, input().split()) Q s = [-INF] + [int(input()) for _ in range(A)] + [INF] [-INF] + [int(input()) for _ in range(A)] + [INF] s INF = float('inf') float('inf') INF
from bisect import bisect
import sys
input = sys.stdin.readline

A, B, Q = map(int, input().split())
INF = float('inf')
s = [-INF] + [int(input()) for _ in range(A)] + [INF]
t = [-INF] + [int(input()) for _ in range(B)] + [INF]
for _ in range(Q):
    x = int(input())
    i = bisect(s, x)
    j = bisect(t, x)
    ans = INF
    for a in [s[i-1], s[i]]:
        for b in [t[j-1], t[j]]:
            ans = min(ans, abs(a-x)+abs(b-a), abs(b-x)+abs(a-b))
    print(ans)
