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

A, B, Q = map(int, input().split())
s = [int(input()) for _ in range(A)]
s.sort()
t = [int(input()) for _ in range(B)]
t.sort()
for _ in range(Q):
    x = int(input())
    i = bisect(s, x)
    sl = sr = 0
    if i == 0:
        sl = -float('inf')
        sr = s[i]
    elif i == A:
        sl = s[i-1]
        sr = float('inf')
    else:
        sl = s[i-1]
        sr = s[i]
    j = bisect(t, x)
    tl = tr = 0
    if j == 0:
        tl = -float('inf')
        tr = t[j]
    elif j == B:
        tl = t[j-1]
        tr = float('inf')
    else:
        tl = t[j-1]
        tr = t[j]
    ans = min(max(sr, tr)-x, x-min(sl, tl), x+sr-2*tl, x+tr-2*sl, 2*sr-x-tl, 2*tr-x-sl)
    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 int(input()) for _ in range(A) for _ in range(A) _ range(A) range A for _ in range(A) int(input()) int input() input s = [int(input()) for _ in range(A)] s [int(input()) for _ in range(A)] s.sort() s.sort s sort int(input()) for _ in range(B) for _ in range(B) _ range(B) range B for _ in range(B) int(input()) int input() input t = [int(input()) for _ in range(B)] t [int(input()) for _ in range(B)] t.sort() t.sort t sort for _ in range(Q):
    x = int(input())
    i = bisect(s, x)
    sl = sr = 0
    if i == 0:
        sl = -float('inf')
        sr = s[i]
    elif i == A:
        sl = s[i-1]
        sr = float('inf')
    else:
        sl = s[i-1]
        sr = s[i]
    j = bisect(t, x)
    tl = tr = 0
    if j == 0:
        tl = -float('inf')
        tr = t[j]
    elif j == B:
        tl = t[j-1]
        tr = float('inf')
    else:
        tl = t[j-1]
        tr = t[j]
    ans = min(max(sr, tr)-x, x-min(sl, tl), x+sr-2*tl, x+tr-2*sl, 2*sr-x-tl, 2*tr-x-sl)
    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 sl = sr = 0 sl 0 = sr = 0 sr 0 if i == 0:
        sl = -float('inf')
        sr = s[i]
    elif i == A:
        sl = s[i-1]
        sr = float('inf')
    else:
        sl = s[i-1]
        sr = s[i]
     i == 0 i 0 sl = -float('inf') sl -float('inf') float('inf') float 'inf' sr = s[i] sr s[i] s i elif i == A:
        sl = s[i-1]
        sr = float('inf')
     i == A i A sl = s[i-1] sl s[i-1] s i-1 i 1 sr = float('inf') sr float('inf') float 'inf' sl = s[i-1] sl s[i-1] s i-1 i 1 sr = s[i] sr s[i] s i j = bisect(t, x) j bisect(t, x) bisect t x tl = tr = 0 tl 0 = tr = 0 tr 0 if j == 0:
        tl = -float('inf')
        tr = t[j]
    elif j == B:
        tl = t[j-1]
        tr = float('inf')
    else:
        tl = t[j-1]
        tr = t[j]
     j == 0 j 0 tl = -float('inf') tl -float('inf') float('inf') float 'inf' tr = t[j] tr t[j] t j elif j == B:
        tl = t[j-1]
        tr = float('inf')
     j == B j B tl = t[j-1] tl t[j-1] t j-1 j 1 tr = float('inf') tr float('inf') float 'inf' tl = t[j-1] tl t[j-1] t j-1 j 1 tr = t[j] tr t[j] t j ans = min(max(sr, tr)-x, x-min(sl, tl), x+sr-2*tl, x+tr-2*sl, 2*sr-x-tl, 2*tr-x-sl) ans min(max(sr, tr)-x, x-min(sl, tl), x+sr-2*tl, x+tr-2*sl, 2*sr-x-tl, 2*tr-x-sl) min max(sr, tr)-x max(sr, tr) max sr tr x x-min(sl, tl) x min(sl, tl) min sl tl x+sr-2*tl x+sr x sr 2*tl 2 tl x+tr-2*sl x+tr x tr 2*sl 2 sl 2*sr-x-tl 2*sr-x 2*sr 2 sr x tl 2*tr-x-sl 2*tr-x 2*tr 2 tr x sl print(ans) print ans sl = sr = 0 0 sl tr = t[j] t[j] tr s = [int(input()) for _ in range(A)] [int(input()) for _ in range(A)] s tl = t[j-1] t[j-1] tl A, B, Q = map(int, input().split()) map(int, input().split()) A B, Q = map(int, input().split()) map(int, input().split()) B t = [int(input()) for _ in range(B)] [int(input()) for _ in range(B)] t Q = map(int, input().split()) map(int, input().split()) Q sr = s[i] s[i] sr x = int(input()) int(input()) x tr = float('inf') float('inf') tr sl = -float('inf') -float('inf') sl tr = 0 0 tr tr = t[j] t[j] tr sl = s[i-1] s[i-1] sl tl = -float('inf') -float('inf') tl sl = s[i-1] s[i-1] sl ans = min(max(sr, tr)-x, x-min(sl, tl), x+sr-2*tl, x+tr-2*sl, 2*sr-x-tl, 2*tr-x-sl) min(max(sr, tr)-x, x-min(sl, tl), x+sr-2*tl, x+tr-2*sl, 2*sr-x-tl, 2*tr-x-sl) ans sr = 0 0 sr sr = s[i] s[i] sr i = bisect(s, x) bisect(s, x) i input = sys.stdin.readline sys.stdin.readline input tl = tr = 0 0 tl sr = float('inf') float('inf') sr j = bisect(t, x) bisect(t, x) j tl = t[j-1] t[j-1] tl
from bisect import bisect
import sys
input = sys.stdin.readline

A, B, Q = map(int, input().split())
s = [int(input()) for _ in range(A)]
s.sort()
t = [int(input()) for _ in range(B)]
t.sort()
for _ in range(Q):
    x = int(input())
    i = bisect(s, x)
    sl = sr = 0
    if i == 0:
        sl = -float('inf')
        sr = s[i]
    elif i == A:
        sl = s[i-1]
        sr = float('inf')
    else:
        sl = s[i-1]
        sr = s[i]
    j = bisect(t, x)
    tl = tr = 0
    if j == 0:
        tl = -float('inf')
        tr = t[j]
    elif j == B:
        tl = t[j-1]
        tr = float('inf')
    else:
        tl = t[j-1]
        tr = t[j]
    ans = min(max(sr, tr)-x, x-min(sl, tl), x+sr-2*tl, x+tr-2*sl, 2*sr-x-tl, 2*tr-x-sl)
    print(ans)
