import sys
import itertools
# import numpy as np
import time
import math
import heapq
from collections import defaultdict
sys.setrecursionlimit(10 ** 7)
 
INF = 10 ** 18
MOD = 10 ** 9 + 7
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines

# map(int, input().split())

A, B, Q = map(int, input().split())
S = [int(input()) for _ in range(A)]
T = [int(input()) for _ in range(B)]
X = [int(input()) for _ in range(Q)]

def bound(Z, z):
    l = 0
    r = len(Z) - 1
    while r - l > 1:
        m = (l + r) // 2
        if Z[m] >= z:
            r = m
        else:
            l = m
    return r

for x in X:
    s = [0] * 2
    s[0] = bound(S, x)
    s[1] = s[0] - 1

    t = [0] * 2
    t[0] = bound(T, x)
    t[1] = t[0] - 1

    ans = INF
    # print("--------------")
    for i in range(2):
        for j in range(2):
            val = 0
            if x >= S[s[i]] and x >= T[t[j]]:
                val = max(abs(x - S[s[i]]), abs(x - T[t[j]]))
            elif x <= S[s[i]] and x <= T[t[j]]:
                val = max(abs(x - S[s[i]]), abs(x - T[t[j]]))
            else:
                val = min(abs(x - S[s[i]]) * 2 + abs(x - T[t[j]]), abs(x - S[s[i]]) + abs(x - T[t[j]]) * 2)
            ans = min(ans, val)
    # print(x)
    # print(S[s[0]], S[s[1]])
    # print(T[t[0]], T[t[1]])
    # print("--------------")
    print(ans)

    # print(S[s1], S[s2], T[t1], T[t2], T[t3], T[t4])
    # val1 = abs(S[s1] - x) + abs(T[t1] - S[s1])
    # val2 = abs(S[s1] - x) + abs(T[t2] - S[s1])
    # val3 = abs(S[s2] - x) + abs(T[t3] - S[s2])
    # val4 = abs(S[s2] - x) + abs(T[t4] - S[s2])
    # print(min(val1, val2, val3, val4)) import sys sys import itertools itertools import time time import math math import heapq heapq from collections import defaultdict sys.setrecursionlimit(10 ** 7) sys.setrecursionlimit sys setrecursionlimit 10 ** 7 10 7 INF = 10 ** 18 INF 10 ** 18 10 18 MOD = 10 ** 9 + 7 MOD 10 ** 9 + 7 10 ** 9 10 9 7 read = sys.stdin.buffer.read read sys.stdin.buffer.read sys.stdin.buffer sys.stdin sys stdin buffer read readline = sys.stdin.buffer.readline readline sys.stdin.buffer.readline sys.stdin.buffer sys.stdin sys stdin buffer readline readlines = sys.stdin.buffer.readlines readlines sys.stdin.buffer.readlines sys.stdin.buffer sys.stdin sys stdin buffer readlines 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)] 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)] int(input()) for _ in range(Q) for _ in range(Q) _ range(Q) range Q for _ in range(Q) int(input()) int input() input X = [int(input()) for _ in range(Q)] X [int(input()) for _ in range(Q)] def bound(Z, z):
    l = 0
    r = len(Z) - 1
    while r - l > 1:
        m = (l + r) // 2
        if Z[m] >= z:
            r = m
        else:
            l = m
    return r bound l = 0 l 0 r = len(Z) - 1 r len(Z) - 1 len(Z) len Z 1 while r - l > 1:
        m = (l + r) // 2
        if Z[m] >= z:
            r = m
        else:
            l = m
     r - l > 1 r - l r l 1 m = (l + r) // 2 m (l + r) // 2 l + r l r 2 if Z[m] >= z:
            r = m
        else:
            l = m
     Z[m] >= z Z[m] Z m z r = m r m l = m l m return r r Z Z z z for x in X:
    s = [0] * 2
    s[0] = bound(S, x)
    s[1] = s[0] - 1

    t = [0] * 2
    t[0] = bound(T, x)
    t[1] = t[0] - 1

    ans = INF
    # print("--------------")
    for i in range(2):
        for j in range(2):
            val = 0
            if x >= S[s[i]] and x >= T[t[j]]:
                val = max(abs(x - S[s[i]]), abs(x - T[t[j]]))
            elif x <= S[s[i]] and x <= T[t[j]]:
                val = max(abs(x - S[s[i]]), abs(x - T[t[j]]))
            else:
                val = min(abs(x - S[s[i]]) * 2 + abs(x - T[t[j]]), abs(x - S[s[i]]) + abs(x - T[t[j]]) * 2)
            ans = min(ans, val)
    # print(x)
    # print(S[s[0]], S[s[1]])
    # print(T[t[0]], T[t[1]])
    # print("--------------")
    print(ans)

    # print(S[s1], S[s2], T[t1], T[t2], T[t3], T[t4])
    # val1 = abs(S[s1] - x) + abs(T[t1] - S[s1])
    # val2 = abs(S[s1] - x) + abs(T[t2] - S[s1])
    # val3 = abs(S[s2] - x) + abs(T[t3] - S[s2])
    # val4 = abs(S[s2] - x) + abs(T[t4] - S[s2])
    # print(min(val1, val2, val3, val4)) x X s = [0] * 2 s [0] * 2 [0] 0 2 s[0] = bound(S, x) s[0] s 0 bound(S, x) bound S x s[1] = s[0] - 1 s[1] s 1 s[0] - 1 s[0] s 0 1 t = [0] * 2 t [0] * 2 [0] 0 2 t[0] = bound(T, x) t[0] t 0 bound(T, x) bound T x t[1] = t[0] - 1 t[1] t 1 t[0] - 1 t[0] t 0 1 ans = INF ans INF for i in range(2):
        for j in range(2):
            val = 0
            if x >= S[s[i]] and x >= T[t[j]]:
                val = max(abs(x - S[s[i]]), abs(x - T[t[j]]))
            elif x <= S[s[i]] and x <= T[t[j]]:
                val = max(abs(x - S[s[i]]), abs(x - T[t[j]]))
            else:
                val = min(abs(x - S[s[i]]) * 2 + abs(x - T[t[j]]), abs(x - S[s[i]]) + abs(x - T[t[j]]) * 2)
            ans = min(ans, val)
    # print(x)
    # print(S[s[0]], S[s[1]])
    # print(T[t[0]], T[t[1]])
    # print("--------------")
     i range(2) range 2 for j in range(2):
            val = 0
            if x >= S[s[i]] and x >= T[t[j]]:
                val = max(abs(x - S[s[i]]), abs(x - T[t[j]]))
            elif x <= S[s[i]] and x <= T[t[j]]:
                val = max(abs(x - S[s[i]]), abs(x - T[t[j]]))
            else:
                val = min(abs(x - S[s[i]]) * 2 + abs(x - T[t[j]]), abs(x - S[s[i]]) + abs(x - T[t[j]]) * 2)
            ans = min(ans, val)
    # print(x)
    # print(S[s[0]], S[s[1]])
    # print(T[t[0]], T[t[1]])
    # print("--------------")
     j range(2) range 2 val = 0 val 0 if x >= S[s[i]] and x >= T[t[j]]:
                val = max(abs(x - S[s[i]]), abs(x - T[t[j]]))
            elif x <= S[s[i]] and x <= T[t[j]]:
                val = max(abs(x - S[s[i]]), abs(x - T[t[j]]))
            else:
                val = min(abs(x - S[s[i]]) * 2 + abs(x - T[t[j]]), abs(x - S[s[i]]) + abs(x - T[t[j]]) * 2)
             x >= S[s[i]] and x >= T[t[j]] x >= S[s[i]] x S[s[i]] S s[i] s i x >= T[t[j]] x T[t[j]] T t[j] t j val = max(abs(x - S[s[i]]), abs(x - T[t[j]])) val max(abs(x - S[s[i]]), abs(x - T[t[j]])) max abs(x - S[s[i]]) abs x - S[s[i]] x S[s[i]] S s[i] s i abs(x - T[t[j]]) abs x - T[t[j]] x T[t[j]] T t[j] t j elif x <= S[s[i]] and x <= T[t[j]]:
                val = max(abs(x - S[s[i]]), abs(x - T[t[j]]))
             x <= S[s[i]] and x <= T[t[j]] x <= S[s[i]] x S[s[i]] S s[i] s i x <= T[t[j]] x T[t[j]] T t[j] t j val = max(abs(x - S[s[i]]), abs(x - T[t[j]])) val max(abs(x - S[s[i]]), abs(x - T[t[j]])) max abs(x - S[s[i]]) abs x - S[s[i]] x S[s[i]] S s[i] s i abs(x - T[t[j]]) abs x - T[t[j]] x T[t[j]] T t[j] t j val = min(abs(x - S[s[i]]) * 2 + abs(x - T[t[j]]), abs(x - S[s[i]]) + abs(x - T[t[j]]) * 2) val min(abs(x - S[s[i]]) * 2 + abs(x - T[t[j]]), abs(x - S[s[i]]) + abs(x - T[t[j]]) * 2) min abs(x - S[s[i]]) * 2 + abs(x - T[t[j]]) abs(x - S[s[i]]) * 2 abs(x - S[s[i]]) abs x - S[s[i]] x S[s[i]] S s[i] s i 2 abs(x - T[t[j]]) abs x - T[t[j]] x T[t[j]] T t[j] t j abs(x - S[s[i]]) + abs(x - T[t[j]]) * 2 abs(x - S[s[i]]) abs x - S[s[i]] x S[s[i]] S s[i] s i abs(x - T[t[j]]) * 2 abs(x - T[t[j]]) abs x - T[t[j]] x T[t[j]] T t[j] t j 2 ans = min(ans, val) ans min(ans, val) min ans val print(ans) print ans Q = map(int, input().split()) map(int, input().split()) Q readline = sys.stdin.buffer.readline sys.stdin.buffer.readline readline ans = INF INF ans T = [int(input()) for _ in range(B)] [int(input()) for _ in range(B)] T val = min(abs(x - S[s[i]]) * 2 + abs(x - T[t[j]]), abs(x - S[s[i]]) + abs(x - T[t[j]]) * 2) min(abs(x - S[s[i]]) * 2 + abs(x - T[t[j]]), abs(x - S[s[i]]) + abs(x - T[t[j]]) * 2) val read = sys.stdin.buffer.read sys.stdin.buffer.read read ans = min(ans, val) min(ans, val) ans def bound(Z, z):
    l = 0
    r = len(Z) - 1
    while r - l > 1:
        m = (l + r) // 2
        if Z[m] >= z:
            r = m
        else:
            l = m
    return r def bound(Z, z):
    l = 0
    r = len(Z) - 1
    while r - l > 1:
        m = (l + r) // 2
        if Z[m] >= z:
            r = m
        else:
            l = m
    return r bound readlines = sys.stdin.buffer.readlines sys.stdin.buffer.readlines readlines val = max(abs(x - S[s[i]]), abs(x - T[t[j]])) max(abs(x - S[s[i]]), abs(x - T[t[j]])) val INF = 10 ** 18 10 ** 18 INF A, B, Q = map(int, input().split()) map(int, input().split()) A B, Q = map(int, input().split()) map(int, input().split()) B val = 0 0 val MOD = 10 ** 9 + 7 10 ** 9 + 7 MOD s = [0] * 2 [0] * 2 s val = max(abs(x - S[s[i]]), abs(x - T[t[j]])) max(abs(x - S[s[i]]), abs(x - T[t[j]])) val t = [0] * 2 [0] * 2 t S = [int(input()) for _ in range(A)] [int(input()) for _ in range(A)] S X = [int(input()) for _ in range(Q)] [int(input()) for _ in range(Q)] X
import sys
import itertools
# import numpy as np
import time
import math
import heapq
from collections import defaultdict
sys.setrecursionlimit(10 ** 7)
 
INF = 10 ** 18
MOD = 10 ** 9 + 7
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines

# map(int, input().split())

A, B, Q = map(int, input().split())
S = [int(input()) for _ in range(A)]
T = [int(input()) for _ in range(B)]
X = [int(input()) for _ in range(Q)]

def bound(Z, z):
    l = 0
    r = len(Z) - 1
    while r - l > 1:
        m = (l + r) // 2
        if Z[m] >= z:
            r = m
        else:
            l = m
    return r

for x in X:
    s = [0] * 2
    s[0] = bound(S, x)
    s[1] = s[0] - 1

    t = [0] * 2
    t[0] = bound(T, x)
    t[1] = t[0] - 1

    ans = INF
    # print("--------------")
    for i in range(2):
        for j in range(2):
            val = 0
            if x >= S[s[i]] and x >= T[t[j]]:
                val = max(abs(x - S[s[i]]), abs(x - T[t[j]]))
            elif x <= S[s[i]] and x <= T[t[j]]:
                val = max(abs(x - S[s[i]]), abs(x - T[t[j]]))
            else:
                val = min(abs(x - S[s[i]]) * 2 + abs(x - T[t[j]]), abs(x - S[s[i]]) + abs(x - T[t[j]]) * 2)
            ans = min(ans, val)
    # print(x)
    # print(S[s[0]], S[s[1]])
    # print(T[t[0]], T[t[1]])
    # print("--------------")
    print(ans)

    # print(S[s1], S[s2], T[t1], T[t2], T[t3], T[t4])
    # val1 = abs(S[s1] - x) + abs(T[t1] - S[s1])
    # val2 = abs(S[s1] - x) + abs(T[t2] - S[s1])
    # val3 = abs(S[s2] - x) + abs(T[t3] - S[s2])
    # val4 = abs(S[s2] - x) + abs(T[t4] - S[s2])
    # print(min(val1, val2, val3, val4))