import sys
sys.setrecursionlimit(10 ** 7)
input = sys.stdin.readline

from bisect import bisect_left
from bisect import bisect_right

a, b, q = map(int, input().split())

s = [0]* a
t = [0]* b
X = [0]* q
for i in range(a):
    s[i] = int(input())

for i in range(b):
    t[i] = int(input())

for i in range(q):
    X[i] = int(input())

INF = float('inf')

for x in X:
    index_ls = bisect_left(s,x)
    index_lt = bisect_left(t,x)
    index_rs = bisect_right(s,x)
    index_rt = bisect_right(t,x)
    ans = INF
    right_s = INF
    left_s = -INF
    right_t = INF
    left_t = -INF

    if index_ls < a: right_s = s[index_ls]
    if index_lt < b: right_t = t[index_lt]
    if index_rs > 0: left_s = s[index_rs-1]
    if index_rt > 0: left_t = t[index_rt-1]

    ans1 = max(right_s-x,right_t-x)
    ans2 = max(x-left_s,x-left_t)
    ans3 = right_s-x + right_s-left_t
    ans4 = right_t-x + right_t-left_s
    ans5 = x-left_t + right_s-left_t
    ans6 = x-left_s + right_t-left_s

    print(min(ans1,ans2,ans3,ans4,ans5,ans6))
 import sys sys sys.setrecursionlimit(10 ** 7) sys.setrecursionlimit sys setrecursionlimit 10 ** 7 10 7 input = sys.stdin.readline input sys.stdin.readline sys.stdin sys stdin readline from bisect import bisect_left from bisect import bisect_right a, b, q = map(int, input().split()) a map(int, input().split()) map int input().split() ().split () input split b q s = [0]* a s [0]* a [0] 0 a t = [0]* b t [0]* b [0] 0 b X = [0]* q X [0]* q [0] 0 q for i in range(a):
    s[i] = int(input()) i range(a) range a s[i] = int(input()) s[i] s i int(input()) int input() input for i in range(b):
    t[i] = int(input()) i range(b) range b t[i] = int(input()) t[i] t i int(input()) int input() input for i in range(q):
    X[i] = int(input()) i range(q) range q X[i] = int(input()) X[i] X i int(input()) int input() input INF = float('inf') INF float('inf') float 'inf' for x in X:
    index_ls = bisect_left(s,x)
    index_lt = bisect_left(t,x)
    index_rs = bisect_right(s,x)
    index_rt = bisect_right(t,x)
    ans = INF
    right_s = INF
    left_s = -INF
    right_t = INF
    left_t = -INF

    if index_ls < a: right_s = s[index_ls]
    if index_lt < b: right_t = t[index_lt]
    if index_rs > 0: left_s = s[index_rs-1]
    if index_rt > 0: left_t = t[index_rt-1]

    ans1 = max(right_s-x,right_t-x)
    ans2 = max(x-left_s,x-left_t)
    ans3 = right_s-x + right_s-left_t
    ans4 = right_t-x + right_t-left_s
    ans5 = x-left_t + right_s-left_t
    ans6 = x-left_s + right_t-left_s

    print(min(ans1,ans2,ans3,ans4,ans5,ans6)) x X index_ls = bisect_left(s,x) index_ls bisect_left(s,x) bisect_left s x index_lt = bisect_left(t,x) index_lt bisect_left(t,x) bisect_left t x index_rs = bisect_right(s,x) index_rs bisect_right(s,x) bisect_right s x index_rt = bisect_right(t,x) index_rt bisect_right(t,x) bisect_right t x ans = INF ans INF right_s = INF right_s INF left_s = -INF left_s -INF INF right_t = INF right_t INF left_t = -INF left_t -INF INF if index_ls < a: right_s = s[index_ls]
     index_ls < a index_ls a if index_lt < b: right_t = t[index_lt]
     index_lt < b index_lt b if index_rs > 0: left_s = s[index_rs-1]
     index_rs > 0 index_rs 0 if index_rt > 0: left_t = t[index_rt-1]

     index_rt > 0 index_rt 0 ans1 = max(right_s-x,right_t-x) ans1 max(right_s-x,right_t-x) max right_s-x right_s x right_t-x right_t x ans2 = max(x-left_s,x-left_t) ans2 max(x-left_s,x-left_t) max x-left_s x left_s x-left_t x left_t ans3 = right_s-x + right_s-left_t ans3 right_s-x + right_s-left_t right_s-x + right_s right_s-x right_s x right_s left_t ans4 = right_t-x + right_t-left_s ans4 right_t-x + right_t-left_s right_t-x + right_t right_t-x right_t x right_t left_s ans5 = x-left_t + right_s-left_t ans5 x-left_t + right_s-left_t x-left_t + right_s x-left_t x left_t right_s left_t ans6 = x-left_s + right_t-left_s ans6 x-left_s + right_t-left_s x-left_s + right_t x-left_s x left_s right_t left_s print(min(ans1,ans2,ans3,ans4,ans5,ans6)) print min(ans1,ans2,ans3,ans4,ans5,ans6) min ans1 ans2 ans3 ans4 ans5 ans6 input = sys.stdin.readline sys.stdin.readline input X = [0]* q [0]* q X b, q = map(int, input().split()) map(int, input().split()) b ans2 = max(x-left_s,x-left_t) max(x-left_s,x-left_t) ans2 ans3 = right_s-x + right_s-left_t right_s-x + right_s-left_t ans3 ans5 = x-left_t + right_s-left_t x-left_t + right_s-left_t ans5 q = map(int, input().split()) map(int, input().split()) q ans = INF INF ans a, b, q = map(int, input().split()) map(int, input().split()) a left_s = -INF -INF left_s index_rt = bisect_right(t,x) bisect_right(t,x) index_rt index_ls = bisect_left(s,x) bisect_left(s,x) index_ls left_t = -INF -INF left_t index_rs = bisect_right(s,x) bisect_right(s,x) index_rs right_t = INF INF right_t right_s = INF INF right_s t = [0]* b [0]* b t s = [0]* a [0]* a s INF = float('inf') float('inf') INF ans4 = right_t-x + right_t-left_s right_t-x + right_t-left_s ans4 ans1 = max(right_s-x,right_t-x) max(right_s-x,right_t-x) ans1 index_lt = bisect_left(t,x) bisect_left(t,x) index_lt ans6 = x-left_s + right_t-left_s x-left_s + right_t-left_s ans6
import sys
sys.setrecursionlimit(10 ** 7)
input = sys.stdin.readline

from bisect import bisect_left
from bisect import bisect_right

a, b, q = map(int, input().split())

s = [0]* a
t = [0]* b
X = [0]* q
for i in range(a):
    s[i] = int(input())

for i in range(b):
    t[i] = int(input())

for i in range(q):
    X[i] = int(input())

INF = float('inf')

for x in X:
    index_ls = bisect_left(s,x)
    index_lt = bisect_left(t,x)
    index_rs = bisect_right(s,x)
    index_rt = bisect_right(t,x)
    ans = INF
    right_s = INF
    left_s = -INF
    right_t = INF
    left_t = -INF

    if index_ls < a: right_s = s[index_ls]
    if index_lt < b: right_t = t[index_lt]
    if index_rs > 0: left_s = s[index_rs-1]
    if index_rt > 0: left_t = t[index_rt-1]

    ans1 = max(right_s-x,right_t-x)
    ans2 = max(x-left_s,x-left_t)
    ans3 = right_s-x + right_s-left_t
    ans4 = right_t-x + right_t-left_s
    ans5 = x-left_t + right_s-left_t
    ans6 = x-left_s + right_t-left_s

    print(min(ans1,ans2,ans3,ans4,ans5,ans6))

