import sys
from bisect import bisect_left
from bisect import bisect_right
input = sys.stdin.readline
a,b,q = map(int, input().split())
INF = 10**20
ss = [-INF] + [int(input()) for i in range(a)] + [INF]
ts = [-INF] + [int(input()) for i in range(b)] + [INF]
xs = [int(input()) for i in range(q)] 

ans = INF
for x in xs:
    si = bisect_left(ss, x)
    ti = bisect_left(ts, x)

    dist1 = abs(x-ss[si-1]) + 2*abs(x-ts[ti])
    dist2 = 2*abs(x-ss[si-1]) + abs(x-ts[ti])
    dist3 = abs(x-ts[ti-1]) + 2*abs(x-ss[si])
    dist4 = 2*abs(x-ts[ti-1]) + abs(x-ss[si])
    dist5 = max(abs(x-ss[si-1]), abs(x-ts[ti-1]))
    dist6 = max(abs(x-ss[si]), abs(x-ts[ti]))
    dist = min(dist1,dist2,dist3,dist4,dist5,dist6)
    # print(dist,"du",x,dist1,dist2,dist3,dist4,dist5,dist6)
    print(dist)

 import sys sys from bisect import bisect_left from bisect import bisect_right 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 = 10**20 INF 10**20 10 20 int(input()) for i in range(a) for i in range(a) i range(a) range a for i in range(a) int(input()) int input() input ss = [-INF] + [int(input()) for i in range(a)] + [INF] ss [-INF] + [int(input()) for i in range(a)] + [INF] [-INF] + [int(input()) for i in range(a)] [-INF] -INF INF [int(input()) for i in range(a)] [INF] INF int(input()) for i in range(b) for i in range(b) i range(b) range b for i in range(b) int(input()) int input() input ts = [-INF] + [int(input()) for i in range(b)] + [INF] ts [-INF] + [int(input()) for i in range(b)] + [INF] [-INF] + [int(input()) for i in range(b)] [-INF] -INF INF [int(input()) for i in range(b)] [INF] INF int(input()) for i in range(q) for i in range(q) i range(q) range q for i in range(q) int(input()) int input() input xs = [int(input()) for i in range(q)] xs [int(input()) for i in range(q)] ans = INF ans INF for x in xs:
    si = bisect_left(ss, x)
    ti = bisect_left(ts, x)

    dist1 = abs(x-ss[si-1]) + 2*abs(x-ts[ti])
    dist2 = 2*abs(x-ss[si-1]) + abs(x-ts[ti])
    dist3 = abs(x-ts[ti-1]) + 2*abs(x-ss[si])
    dist4 = 2*abs(x-ts[ti-1]) + abs(x-ss[si])
    dist5 = max(abs(x-ss[si-1]), abs(x-ts[ti-1]))
    dist6 = max(abs(x-ss[si]), abs(x-ts[ti]))
    dist = min(dist1,dist2,dist3,dist4,dist5,dist6)
    # print(dist,"du",x,dist1,dist2,dist3,dist4,dist5,dist6)
    print(dist) x xs si = bisect_left(ss, x) si bisect_left(ss, x) bisect_left ss x ti = bisect_left(ts, x) ti bisect_left(ts, x) bisect_left ts x dist1 = abs(x-ss[si-1]) + 2*abs(x-ts[ti]) dist1 abs(x-ss[si-1]) + 2*abs(x-ts[ti]) abs(x-ss[si-1]) abs x-ss[si-1] x ss[si-1] ss si-1 si 1 2*abs(x-ts[ti]) 2 abs(x-ts[ti]) abs x-ts[ti] x ts[ti] ts ti dist2 = 2*abs(x-ss[si-1]) + abs(x-ts[ti]) dist2 2*abs(x-ss[si-1]) + abs(x-ts[ti]) 2*abs(x-ss[si-1]) 2 abs(x-ss[si-1]) abs x-ss[si-1] x ss[si-1] ss si-1 si 1 abs(x-ts[ti]) abs x-ts[ti] x ts[ti] ts ti dist3 = abs(x-ts[ti-1]) + 2*abs(x-ss[si]) dist3 abs(x-ts[ti-1]) + 2*abs(x-ss[si]) abs(x-ts[ti-1]) abs x-ts[ti-1] x ts[ti-1] ts ti-1 ti 1 2*abs(x-ss[si]) 2 abs(x-ss[si]) abs x-ss[si] x ss[si] ss si dist4 = 2*abs(x-ts[ti-1]) + abs(x-ss[si]) dist4 2*abs(x-ts[ti-1]) + abs(x-ss[si]) 2*abs(x-ts[ti-1]) 2 abs(x-ts[ti-1]) abs x-ts[ti-1] x ts[ti-1] ts ti-1 ti 1 abs(x-ss[si]) abs x-ss[si] x ss[si] ss si dist5 = max(abs(x-ss[si-1]), abs(x-ts[ti-1])) dist5 max(abs(x-ss[si-1]), abs(x-ts[ti-1])) max abs(x-ss[si-1]) abs x-ss[si-1] x ss[si-1] ss si-1 si 1 abs(x-ts[ti-1]) abs x-ts[ti-1] x ts[ti-1] ts ti-1 ti 1 dist6 = max(abs(x-ss[si]), abs(x-ts[ti])) dist6 max(abs(x-ss[si]), abs(x-ts[ti])) max abs(x-ss[si]) abs x-ss[si] x ss[si] ss si abs(x-ts[ti]) abs x-ts[ti] x ts[ti] ts ti dist = min(dist1,dist2,dist3,dist4,dist5,dist6) dist min(dist1,dist2,dist3,dist4,dist5,dist6) min dist1 dist2 dist3 dist4 dist5 dist6 print(dist) print dist dist6 = max(abs(x-ss[si]), abs(x-ts[ti])) max(abs(x-ss[si]), abs(x-ts[ti])) dist6 ts = [-INF] + [int(input()) for i in range(b)] + [INF] [-INF] + [int(input()) for i in range(b)] + [INF] ts dist3 = abs(x-ts[ti-1]) + 2*abs(x-ss[si]) abs(x-ts[ti-1]) + 2*abs(x-ss[si]) dist3 dist = min(dist1,dist2,dist3,dist4,dist5,dist6) min(dist1,dist2,dist3,dist4,dist5,dist6) dist input = sys.stdin.readline sys.stdin.readline input INF = 10**20 10**20 INF xs = [int(input()) for i in range(q)] [int(input()) for i in range(q)] xs ss = [-INF] + [int(input()) for i in range(a)] + [INF] [-INF] + [int(input()) for i in range(a)] + [INF] ss dist4 = 2*abs(x-ts[ti-1]) + abs(x-ss[si]) 2*abs(x-ts[ti-1]) + abs(x-ss[si]) dist4 si = bisect_left(ss, x) bisect_left(ss, x) si ti = bisect_left(ts, x) bisect_left(ts, x) ti a,b,q = map(int, input().split()) map(int, input().split()) a dist5 = max(abs(x-ss[si-1]), abs(x-ts[ti-1])) max(abs(x-ss[si-1]), abs(x-ts[ti-1])) dist5 q = map(int, input().split()) map(int, input().split()) q dist1 = abs(x-ss[si-1]) + 2*abs(x-ts[ti]) abs(x-ss[si-1]) + 2*abs(x-ts[ti]) dist1 dist2 = 2*abs(x-ss[si-1]) + abs(x-ts[ti]) 2*abs(x-ss[si-1]) + abs(x-ts[ti]) dist2 b,q = map(int, input().split()) map(int, input().split()) b ans = INF INF ans
import sys
from bisect import bisect_left
from bisect import bisect_right
input = sys.stdin.readline
a,b,q = map(int, input().split())
INF = 10**20
ss = [-INF] + [int(input()) for i in range(a)] + [INF]
ts = [-INF] + [int(input()) for i in range(b)] + [INF]
xs = [int(input()) for i in range(q)] 

ans = INF
for x in xs:
    si = bisect_left(ss, x)
    ti = bisect_left(ts, x)

    dist1 = abs(x-ss[si-1]) + 2*abs(x-ts[ti])
    dist2 = 2*abs(x-ss[si-1]) + abs(x-ts[ti])
    dist3 = abs(x-ts[ti-1]) + 2*abs(x-ss[si])
    dist4 = 2*abs(x-ts[ti-1]) + abs(x-ss[si])
    dist5 = max(abs(x-ss[si-1]), abs(x-ts[ti-1]))
    dist6 = max(abs(x-ss[si]), abs(x-ts[ti]))
    dist = min(dist1,dist2,dist3,dist4,dist5,dist6)
    # print(dist,"du",x,dist1,dist2,dist3,dist4,dist5,dist6)
    print(dist)


