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

INF = 10 ** 11

s = [int(eval(input())) for _ in range(a)] + [INF]

t = [int(eval(input())) for _ in range(b)] + [INF]

x = [[int(eval(input())), int(i), INF, INF, INF, INF] for i in range(q)]

x.sort(key=lambda x: x[0])

si = 0

ti = 0

for i in range(q):

    xi = x[i][0]

    while xi > s[si]:

        si += 1

    ls = abs(xi - s[si - 1])

    rs = abs(xi - s[si])



    while xi > t[ti]:

        ti += 1

    lt = abs(xi - t[ti - 1])

    rt = abs(xi - t[ti])



    x[i][2] = ls

    x[i][3] = rs

    x[i][4] = lt

    x[i][5] = rt



x.sort(key=lambda x: x[1])

for xi, i, ls, rs, lt, rt in x:

    ans = min(max(ls, lt),

              max(rs, rt),

              min(ls, rt) * 2 + max(ls, rt),

              min(rs, lt) * 2 + max(rs, lt))

    print(ans)
import sys

input = sys.stdin.readline



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

INF = 10 ** 11

s = [int(eval(input())) for _ in range(a)] + [INF]

t = [int(eval(input())) for _ in range(b)] + [INF]

x = [[int(eval(input())), int(i), INF, INF, INF, INF] for i in range(q)]

x.sort(key=lambda x: x[0])

si = 0

ti = 0

for i in range(q):

    xi = x[i][0]

    while xi > s[si]:

        si += 1

    ls = abs(xi - s[si - 1])

    rs = abs(xi - s[si])



    while xi > t[ti]:

        ti += 1

    lt = abs(xi - t[ti - 1])

    rt = abs(xi - t[ti])



    x[i][2] = ls

    x[i][3] = rs

    x[i][4] = lt

    x[i][5] = rt



x.sort(key=lambda x: x[1])

for xi, i, ls, rs, lt, rt in x:

    ans = min(max(ls, lt),

              max(rs, rt),

              min(ls, rt) * 2 + max(ls, rt),

              min(rs, lt) * 2 + max(rs, lt))

    print(ans)
a, b, q = list(map(int, input().split()))
INF = 10**11
s = [int(eval(input())) for _ in range(a)] + [INF]
t = [int(eval(input())) for _ in range(b)] + [INF]
x = [[int(eval(input())), int(i), INF, INF, INF, INF] for i in range(q)]
x.sort(key=lambda x: x[0])
si = 0
ti = 0
for i in range(q):
    xi = x[i][0]
    while xi > s[si]:
        si += 1
    ls = abs(xi - s[si - 1])
    rs = abs(xi - s[si])
    while xi > t[ti]:
        ti += 1
    lt = abs(xi - t[ti - 1])
    rt = abs(xi - t[ti])
    x[i][2] = ls
    x[i][3] = rs
    x[i][4] = lt
    x[i][5] = rt
x.sort(key=lambda x: x[1])
for xi, i, ls, rs, lt, rt in x:
    ans = min(
        max(ls, lt),
        max(rs, rt),
        min(ls, rt) * 2 + max(ls, rt),
        min(rs, lt) * 2 + max(rs, lt),
    )
    print(ans)

import sys

input = sys.stdin.readline
a, b, q = list(map(int, input().split()))
INF = 10**11
s = [int(eval(input())) for _ in range(a)] + [INF]
t = [int(eval(input())) for _ in range(b)] + [INF]
x = [[int(eval(input())), int(i), INF, INF, INF, INF] for i in range(q)]
x.sort(key=lambda x: x[0])
si = 0
ti = 0
for i in range(q):
    xi = x[i][0]
    while xi > s[si]:
        si += 1
    ls = abs(xi - s[si - 1])
    rs = abs(xi - s[si])
    while xi > t[ti]:
        ti += 1
    lt = abs(xi - t[ti - 1])
    rt = abs(xi - t[ti])
    x[i][2] = ls
    x[i][3] = rs
    x[i][4] = lt
    x[i][5] = rt
x.sort(key=lambda x: x[1])
for xi, i, ls, rs, lt, rt in x:
    ans = min(
        max(ls, lt),
        max(rs, rt),
        min(ls, rt) * 2 + max(ls, rt),
        min(rs, lt) * 2 + max(rs, lt),
    )
    print(ans)

+import sys + +input = sys.stdin.readline