import bisect
import sys
input = sys.stdin.readline

A,B,Q = map(int,(input().split()))
s = [[0]*3 for _ in range(A)]
t = [[0]*3 for _ in range(B)]
x = [[0]*3 for _ in range(Q)]
slen = []
tlen = []
road = []
for i in range(A):
    s[i][0] = int(input())
    slen.append(s[i][0])
    s[i][1] = "s"
    road.append(s[i])
for i in range(B):
    t[i][0] = int(input())
    tlen.append(t[i][0])
    t[i][1] = "t"
    road.append(t[i])
for i in range(Q):
    x[i][0] = int(input())
road.sort()

for i in range(len(s)):
    index = bisect.bisect_left(tlen,s[i][0])
    if index < B:
        s[i][2] = min(abs(s[i][0]-tlen[index-1]),abs(tlen[index]-s[i][0]))
    else:
        s[i][2] = abs(s[i][0]-tlen[index-1])
for i in range(len(t)):
    index = bisect.bisect_left(slen,t[i][0])
    if index < A:
        t[i][2] = min(abs(t[i][0]-slen[index-1]),abs(slen[index]-t[i][0]))
    else:
        t[i][2] = abs(t[i][0]-slen[index-1])

for i in range(Q):
    index = bisect.bisect_left(road,x[i])
    if index < A+B:
        print(min(abs(x[i][0]-road[index-1][0])+road[index-1][2],abs(x[i][0]-road[index][0])+road[index][2]))
    else:
        print(abs(x[i][0]-road[index-1][0])+road[index-1][2]) import bisect 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 [0]*3 for _ in range(A) for _ in range(A) _ range(A) range A for _ in range(A) [0]*3 [0] 0 3 s = [[0]*3 for _ in range(A)] s [[0]*3 for _ in range(A)] [0]*3 for _ in range(B) for _ in range(B) _ range(B) range B for _ in range(B) [0]*3 [0] 0 3 t = [[0]*3 for _ in range(B)] t [[0]*3 for _ in range(B)] [0]*3 for _ in range(Q) for _ in range(Q) _ range(Q) range Q for _ in range(Q) [0]*3 [0] 0 3 x = [[0]*3 for _ in range(Q)] x [[0]*3 for _ in range(Q)] slen = [] slen [] tlen = [] tlen [] road = [] road [] for i in range(A):
    s[i][0] = int(input())
    slen.append(s[i][0])
    s[i][1] = "s"
    road.append(s[i]) i range(A) range A s[i][0] = int(input()) s[i][0] [i] s i 0 int(input()) int input() input slen.append(s[i][0]) slen.append slen append s[i][0] [i] s i 0 s[i][1] = "s" s[i][1] [i] s i 1 "s" road.append(s[i]) road.append road append s[i] s i for i in range(B):
    t[i][0] = int(input())
    tlen.append(t[i][0])
    t[i][1] = "t"
    road.append(t[i]) i range(B) range B t[i][0] = int(input()) t[i][0] [i] t i 0 int(input()) int input() input tlen.append(t[i][0]) tlen.append tlen append t[i][0] [i] t i 0 t[i][1] = "t" t[i][1] [i] t i 1 "t" road.append(t[i]) road.append road append t[i] t i for i in range(Q):
    x[i][0] = int(input()) i range(Q) range Q x[i][0] = int(input()) x[i][0] [i] x i 0 int(input()) int input() input road.sort() road.sort road sort for i in range(len(s)):
    index = bisect.bisect_left(tlen,s[i][0])
    if index < B:
        s[i][2] = min(abs(s[i][0]-tlen[index-1]),abs(tlen[index]-s[i][0]))
    else:
        s[i][2] = abs(s[i][0]-tlen[index-1]) i range(len(s)) range len(s) len s index = bisect.bisect_left(tlen,s[i][0]) index bisect.bisect_left(tlen,s[i][0]) bisect.bisect_left bisect bisect_left tlen s[i][0] [i] s i 0 if index < B:
        s[i][2] = min(abs(s[i][0]-tlen[index-1]),abs(tlen[index]-s[i][0]))
    else:
        s[i][2] = abs(s[i][0]-tlen[index-1]) index < B index B s[i][2] = min(abs(s[i][0]-tlen[index-1]),abs(tlen[index]-s[i][0])) s[i][2] [i] s i 2 min(abs(s[i][0]-tlen[index-1]),abs(tlen[index]-s[i][0])) min abs(s[i][0]-tlen[index-1]) abs s[i][0]-tlen[index-1] s[i][0] [i] s i 0 tlen[index-1] tlen index-1 index 1 abs(tlen[index]-s[i][0]) abs tlen[index]-s[i][0] tlen[index] tlen index s[i][0] [i] s i 0 s[i][2] = abs(s[i][0]-tlen[index-1]) s[i][2] [i] s i 2 abs(s[i][0]-tlen[index-1]) abs s[i][0]-tlen[index-1] s[i][0] [i] s i 0 tlen[index-1] tlen index-1 index 1 for i in range(len(t)):
    index = bisect.bisect_left(slen,t[i][0])
    if index < A:
        t[i][2] = min(abs(t[i][0]-slen[index-1]),abs(slen[index]-t[i][0]))
    else:
        t[i][2] = abs(t[i][0]-slen[index-1]) i range(len(t)) range len(t) len t index = bisect.bisect_left(slen,t[i][0]) index bisect.bisect_left(slen,t[i][0]) bisect.bisect_left bisect bisect_left slen t[i][0] [i] t i 0 if index < A:
        t[i][2] = min(abs(t[i][0]-slen[index-1]),abs(slen[index]-t[i][0]))
    else:
        t[i][2] = abs(t[i][0]-slen[index-1]) index < A index A t[i][2] = min(abs(t[i][0]-slen[index-1]),abs(slen[index]-t[i][0])) t[i][2] [i] t i 2 min(abs(t[i][0]-slen[index-1]),abs(slen[index]-t[i][0])) min abs(t[i][0]-slen[index-1]) abs t[i][0]-slen[index-1] t[i][0] [i] t i 0 slen[index-1] slen index-1 index 1 abs(slen[index]-t[i][0]) abs slen[index]-t[i][0] slen[index] slen index t[i][0] [i] t i 0 t[i][2] = abs(t[i][0]-slen[index-1]) t[i][2] [i] t i 2 abs(t[i][0]-slen[index-1]) abs t[i][0]-slen[index-1] t[i][0] [i] t i 0 slen[index-1] slen index-1 index 1 for i in range(Q):
    index = bisect.bisect_left(road,x[i])
    if index < A+B:
        print(min(abs(x[i][0]-road[index-1][0])+road[index-1][2],abs(x[i][0]-road[index][0])+road[index][2]))
    else:
        print(abs(x[i][0]-road[index-1][0])+road[index-1][2]) i range(Q) range Q index = bisect.bisect_left(road,x[i]) index bisect.bisect_left(road,x[i]) bisect.bisect_left bisect bisect_left road x[i] x i if index < A+B:
        print(min(abs(x[i][0]-road[index-1][0])+road[index-1][2],abs(x[i][0]-road[index][0])+road[index][2]))
    else:
        print(abs(x[i][0]-road[index-1][0])+road[index-1][2]) index < A+B index A+B A B print(min(abs(x[i][0]-road[index-1][0])+road[index-1][2],abs(x[i][0]-road[index][0])+road[index][2])) print min(abs(x[i][0]-road[index-1][0])+road[index-1][2],abs(x[i][0]-road[index][0])+road[index][2]) min abs(x[i][0]-road[index-1][0])+road[index-1][2] abs(x[i][0]-road[index-1][0]) abs x[i][0]-road[index-1][0] x[i][0] [i] x i 0 road[index-1][0] [index-1] road index-1 index 1 0 road[index-1][2] [index-1] road index-1 index 1 2 abs(x[i][0]-road[index][0])+road[index][2] abs(x[i][0]-road[index][0]) abs x[i][0]-road[index][0] x[i][0] [i] x i 0 road[index][0] [index] road index 0 road[index][2] [index] road index 2 print(abs(x[i][0]-road[index-1][0])+road[index-1][2]) print abs(x[i][0]-road[index-1][0])+road[index-1][2] abs(x[i][0]-road[index-1][0]) abs x[i][0]-road[index-1][0] x[i][0] [i] x i 0 road[index-1][0] [index-1] road index-1 index 1 0 road[index-1][2] [index-1] road index-1 index 1 2 Q = map(int,(input().split())) map(int,(input().split())) Q t = [[0]*3 for _ in range(B)] [[0]*3 for _ in range(B)] t s = [[0]*3 for _ in range(A)] [[0]*3 for _ in range(A)] s index = bisect.bisect_left(road,x[i]) bisect.bisect_left(road,x[i]) index A,B,Q = map(int,(input().split())) map(int,(input().split())) A index = bisect.bisect_left(tlen,s[i][0]) bisect.bisect_left(tlen,s[i][0]) index index = bisect.bisect_left(slen,t[i][0]) bisect.bisect_left(slen,t[i][0]) index input = sys.stdin.readline sys.stdin.readline input x = [[0]*3 for _ in range(Q)] [[0]*3 for _ in range(Q)] x slen = [] [] slen road = [] [] road tlen = [] [] tlen B,Q = map(int,(input().split())) map(int,(input().split())) B
import bisect
import sys
input = sys.stdin.readline

A,B,Q = map(int,(input().split()))
s = [[0]*3 for _ in range(A)]
t = [[0]*3 for _ in range(B)]
x = [[0]*3 for _ in range(Q)]
slen = []
tlen = []
road = []
for i in range(A):
    s[i][0] = int(input())
    slen.append(s[i][0])
    s[i][1] = "s"
    road.append(s[i])
for i in range(B):
    t[i][0] = int(input())
    tlen.append(t[i][0])
    t[i][1] = "t"
    road.append(t[i])
for i in range(Q):
    x[i][0] = int(input())
road.sort()

for i in range(len(s)):
    index = bisect.bisect_left(tlen,s[i][0])
    if index < B:
        s[i][2] = min(abs(s[i][0]-tlen[index-1]),abs(tlen[index]-s[i][0]))
    else:
        s[i][2] = abs(s[i][0]-tlen[index-1])
for i in range(len(t)):
    index = bisect.bisect_left(slen,t[i][0])
    if index < A:
        t[i][2] = min(abs(t[i][0]-slen[index-1]),abs(slen[index]-t[i][0]))
    else:
        t[i][2] = abs(t[i][0]-slen[index-1])

for i in range(Q):
    index = bisect.bisect_left(road,x[i])
    if index < A+B:
        print(min(abs(x[i][0]-road[index-1][0])+road[index-1][2],abs(x[i][0]-road[index][0])+road[index][2]))
    else:
        print(abs(x[i][0]-road[index-1][0])+road[index-1][2])