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

A, B, Q = map(int, input().split())
s = [-10**18]+[int(input()) for _ in range(A)]+[10**18]
t = [-10**18]+[int(input()) for _ in range(B)]+[10**18]

for _ in range(Q):
    x = int(input())
    idx1 = bisect_right(s, x)
    idx2 = bisect_right(t, x)
    ls, rs = s[idx1-1], s[idx1]
    lt, rt = t[idx2-1], t[idx2]
    ans = 10**18
    
    for p1, p2 in [(ls, lt), (ls, rt), (rs, lt), (rs, rt), (lt, ls), (lt, rs), (rt, ls), (rt, rs)]:
        ans = min(ans, abs(p1-x)+abs(p2-p1))
    
    print(ans) import sys sys input = sys.stdin.readline input sys.stdin.readline sys.stdin sys stdin readline 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 = [-10**18]+[int(input()) for _ in range(A)]+[10**18] s [-10**18]+[int(input()) for _ in range(A)]+[10**18] [-10**18]+[int(input()) for _ in range(A)] [-10**18] -10**18 -10 18 [int(input()) for _ in range(A)] [10**18] 10**18 10 18 int(input()) for _ in range(B) for _ in range(B) _ range(B) range B for _ in range(B) int(input()) int input() input t = [-10**18]+[int(input()) for _ in range(B)]+[10**18] t [-10**18]+[int(input()) for _ in range(B)]+[10**18] [-10**18]+[int(input()) for _ in range(B)] [-10**18] -10**18 -10 18 [int(input()) for _ in range(B)] [10**18] 10**18 10 18 for _ in range(Q):
    x = int(input())
    idx1 = bisect_right(s, x)
    idx2 = bisect_right(t, x)
    ls, rs = s[idx1-1], s[idx1]
    lt, rt = t[idx2-1], t[idx2]
    ans = 10**18
    
    for p1, p2 in [(ls, lt), (ls, rt), (rs, lt), (rs, rt), (lt, ls), (lt, rs), (rt, ls), (rt, rs)]:
        ans = min(ans, abs(p1-x)+abs(p2-p1))
    
    print(ans) _ range(Q) range Q x = int(input()) x int(input()) int input() input idx1 = bisect_right(s, x) idx1 bisect_right(s, x) bisect_right s x idx2 = bisect_right(t, x) idx2 bisect_right(t, x) bisect_right t x ls, rs = s[idx1-1], s[idx1] ls s[idx1-1] s idx1-1 idx1 1 rs s[idx1] s idx1 lt, rt = t[idx2-1], t[idx2] lt t[idx2-1] t idx2-1 idx2 1 rt t[idx2] t idx2 ans = 10**18 ans 10**18 10 18 for p1, p2 in [(ls, lt), (ls, rt), (rs, lt), (rs, rt), (lt, ls), (lt, rs), (rt, ls), (rt, rs)]:
        ans = min(ans, abs(p1-x)+abs(p2-p1))
    
     p1 p2 [(ls, lt), (ls, rt), (rs, lt), (rs, rt), (lt, ls), (lt, rs), (rt, ls), (rt, rs)] (ls, lt) ls lt (ls, rt) ls rt (rs, lt) rs lt (rs, rt) rs rt (lt, ls) lt ls (lt, rs) lt rs (rt, ls) rt ls (rt, rs) rt rs ans = min(ans, abs(p1-x)+abs(p2-p1)) ans min(ans, abs(p1-x)+abs(p2-p1)) min ans abs(p1-x)+abs(p2-p1) abs(p1-x) abs p1-x p1 x abs(p2-p1) abs p2-p1 p2 p1 print(ans) print ans rs = s[idx1-1], s[idx1] s[idx1] rs Q = map(int, input().split()) map(int, input().split()) Q s = [-10**18]+[int(input()) for _ in range(A)]+[10**18] [-10**18]+[int(input()) for _ in range(A)]+[10**18] s idx2 = bisect_right(t, x) bisect_right(t, x) idx2 ans = min(ans, abs(p1-x)+abs(p2-p1)) min(ans, abs(p1-x)+abs(p2-p1)) ans lt, rt = t[idx2-1], t[idx2] t[idx2-1] lt x = int(input()) int(input()) x idx1 = bisect_right(s, x) bisect_right(s, x) idx1 B, Q = map(int, input().split()) map(int, input().split()) B t = [-10**18]+[int(input()) for _ in range(B)]+[10**18] [-10**18]+[int(input()) for _ in range(B)]+[10**18] t A, B, Q = map(int, input().split()) map(int, input().split()) A rt = t[idx2-1], t[idx2] t[idx2] rt ls, rs = s[idx1-1], s[idx1] s[idx1-1] ls ans = 10**18 10**18 ans input = sys.stdin.readline sys.stdin.readline input
import sys
input = sys.stdin.readline
from bisect import *

A, B, Q = map(int, input().split())
s = [-10**18]+[int(input()) for _ in range(A)]+[10**18]
t = [-10**18]+[int(input()) for _ in range(B)]+[10**18]

for _ in range(Q):
    x = int(input())
    idx1 = bisect_right(s, x)
    idx2 = bisect_right(t, x)
    ls, rs = s[idx1-1], s[idx1]
    lt, rt = t[idx2-1], t[idx2]
    ans = 10**18
    
    for p1, p2 in [(ls, lt), (ls, rt), (rs, lt), (rs, rt), (lt, ls), (lt, rs), (rt, ls), (rt, rs)]:
        ans = min(ans, abs(p1-x)+abs(p2-p1))
    
    print(ans)