import sys
import re
import math
import collections
import bisect
import itertools
import fractions
import functools
import copy
import heapq
import decimal
import statistics
import queue

# import numpy as np

sys.setrecursionlimit(10 ** 9)
INF = 10 ** 16
MOD = 10 ** 9 + 7
# MOD = 998244353

ni = lambda: int(sys.stdin.readline())
ns = lambda: map(int, sys.stdin.readline().split())
na = lambda: list(map(int, sys.stdin.readline().split()))
na1 = lambda: list(map(lambda x: int(x) - 1, sys.stdin.readline().split()))


# ===CODE===



def main():
    a, b, q = ns()
    s = [ni() for _ in range(a)]
    t = [ni() for _ in range(b)]

    def disLR(a, idx):
        small = a[max(0, idx - 1)]
        large = a[min(len(a) - 1, idx)]
        return [small, large]

    for _ in range(q):
        ans = INF

        x = ni()

        idxs = bisect.bisect_left(s, x)
        a1 = disLR(s, idxs)

        idxt = bisect.bisect_left(t, x)
        a2 = disLR(t, idxt)

        for ta1 in a1:
            for ta2 in a2:
                tmp1 = abs(x - ta1) + abs(ta2 - ta1)
                tmp2 = abs(x - ta2) + abs(ta1 - ta2)
                ans = min(ans, tmp1, tmp2)

        print(ans)


if __name__ == '__main__':
    main() import sys sys import re re import math math import collections collections import bisect bisect import itertools itertools import fractions fractions import functools functools import copy copy import heapq heapq import decimal decimal import statistics statistics import queue queue sys.setrecursionlimit(10 ** 9) sys.setrecursionlimit sys setrecursionlimit 10 ** 9 10 9 INF = 10 ** 16 INF 10 ** 16 10 16 MOD = 10 ** 9 + 7 MOD 10 ** 9 + 7 10 ** 9 10 9 7 ni = lambda: int(sys.stdin.readline()) ni lambda: int(sys.stdin.readline()) int(sys.stdin.readline()) int sys.stdin.readline() sys.stdin.readline sys.stdin sys stdin readline ns = lambda: map(int, sys.stdin.readline().split()) ns lambda: map(int, sys.stdin.readline().split()) map(int, sys.stdin.readline().split()) map int sys.stdin.readline().split() sys.stdin.readline().split sys.stdin.readline() sys.stdin.readline sys.stdin sys stdin readline split na = lambda: list(map(int, sys.stdin.readline().split())) na lambda: list(map(int, sys.stdin.readline().split())) list(map(int, sys.stdin.readline().split())) list map(int, sys.stdin.readline().split()) map int sys.stdin.readline().split() sys.stdin.readline().split sys.stdin.readline() sys.stdin.readline sys.stdin sys stdin readline split na1 = lambda: list(map(lambda x: int(x) - 1, sys.stdin.readline().split())) na1 lambda: list(map(lambda x: int(x) - 1, sys.stdin.readline().split())) list(map(lambda x: int(x) - 1, sys.stdin.readline().split())) list map(lambda x: int(x) - 1, sys.stdin.readline().split()) map lambda x: int(x) - 1 int(x) - 1 int(x) int x 1 x sys.stdin.readline().split() sys.stdin.readline().split sys.stdin.readline() sys.stdin.readline sys.stdin sys stdin readline split def main():
    a, b, q = ns()
    s = [ni() for _ in range(a)]
    t = [ni() for _ in range(b)]

    def disLR(a, idx):
        small = a[max(0, idx - 1)]
        large = a[min(len(a) - 1, idx)]
        return [small, large]

    for _ in range(q):
        ans = INF

        x = ni()

        idxs = bisect.bisect_left(s, x)
        a1 = disLR(s, idxs)

        idxt = bisect.bisect_left(t, x)
        a2 = disLR(t, idxt)

        for ta1 in a1:
            for ta2 in a2:
                tmp1 = abs(x - ta1) + abs(ta2 - ta1)
                tmp2 = abs(x - ta2) + abs(ta1 - ta2)
                ans = min(ans, tmp1, tmp2)

        print(ans) main a, b, q = ns() a ns() ns b q ni() for _ in range(a) for _ in range(a) _ range(a) range a for _ in range(a) ni() ni s = [ni() for _ in range(a)] s [ni() for _ in range(a)] ni() for _ in range(b) for _ in range(b) _ range(b) range b for _ in range(b) ni() ni t = [ni() for _ in range(b)] t [ni() for _ in range(b)] def disLR(a, idx):
        small = a[max(0, idx - 1)]
        large = a[min(len(a) - 1, idx)]
        return [small, large]

     disLR small = a[max(0, idx - 1)] small a[max(0, idx - 1)] a max(0, idx - 1) max 0 idx - 1 idx 1 large = a[min(len(a) - 1, idx)] large a[min(len(a) - 1, idx)] a min(len(a) - 1, idx) min len(a) - 1 len(a) len a 1 idx return [small, large] [small, large] small large a a idx idx for _ in range(q):
        ans = INF

        x = ni()

        idxs = bisect.bisect_left(s, x)
        a1 = disLR(s, idxs)

        idxt = bisect.bisect_left(t, x)
        a2 = disLR(t, idxt)

        for ta1 in a1:
            for ta2 in a2:
                tmp1 = abs(x - ta1) + abs(ta2 - ta1)
                tmp2 = abs(x - ta2) + abs(ta1 - ta2)
                ans = min(ans, tmp1, tmp2)

        print(ans) _ range(q) range q ans = INF ans INF x = ni() x ni() ni idxs = bisect.bisect_left(s, x) idxs bisect.bisect_left(s, x) bisect.bisect_left bisect bisect_left s x a1 = disLR(s, idxs) a1 disLR(s, idxs) disLR s idxs idxt = bisect.bisect_left(t, x) idxt bisect.bisect_left(t, x) bisect.bisect_left bisect bisect_left t x a2 = disLR(t, idxt) a2 disLR(t, idxt) disLR t idxt for ta1 in a1:
            for ta2 in a2:
                tmp1 = abs(x - ta1) + abs(ta2 - ta1)
                tmp2 = abs(x - ta2) + abs(ta1 - ta2)
                ans = min(ans, tmp1, tmp2)

         ta1 a1 for ta2 in a2:
                tmp1 = abs(x - ta1) + abs(ta2 - ta1)
                tmp2 = abs(x - ta2) + abs(ta1 - ta2)
                ans = min(ans, tmp1, tmp2)

         ta2 a2 tmp1 = abs(x - ta1) + abs(ta2 - ta1) tmp1 abs(x - ta1) + abs(ta2 - ta1) abs(x - ta1) abs x - ta1 x ta1 abs(ta2 - ta1) abs ta2 - ta1 ta2 ta1 tmp2 = abs(x - ta2) + abs(ta1 - ta2) tmp2 abs(x - ta2) + abs(ta1 - ta2) abs(x - ta2) abs x - ta2 x ta2 abs(ta1 - ta2) abs ta1 - ta2 ta1 ta2 ans = min(ans, tmp1, tmp2) ans min(ans, tmp1, tmp2) min ans tmp1 tmp2 print(ans) print ans if __name__ == '__main__':
    main() __name__ == '__main__' __name__ '__main__' main() main na = lambda: list(map(int, sys.stdin.readline().split())) lambda: list(map(int, sys.stdin.readline().split())) na ns = lambda: map(int, sys.stdin.readline().split()) lambda: map(int, sys.stdin.readline().split()) ns def main():
    a, b, q = ns()
    s = [ni() for _ in range(a)]
    t = [ni() for _ in range(b)]

    def disLR(a, idx):
        small = a[max(0, idx - 1)]
        large = a[min(len(a) - 1, idx)]
        return [small, large]

    for _ in range(q):
        ans = INF

        x = ni()

        idxs = bisect.bisect_left(s, x)
        a1 = disLR(s, idxs)

        idxt = bisect.bisect_left(t, x)
        a2 = disLR(t, idxt)

        for ta1 in a1:
            for ta2 in a2:
                tmp1 = abs(x - ta1) + abs(ta2 - ta1)
                tmp2 = abs(x - ta2) + abs(ta1 - ta2)
                ans = min(ans, tmp1, tmp2)

        print(ans) def main():
    a, b, q = ns()
    s = [ni() for _ in range(a)]
    t = [ni() for _ in range(b)]

    def disLR(a, idx):
        small = a[max(0, idx - 1)]
        large = a[min(len(a) - 1, idx)]
        return [small, large]

    for _ in range(q):
        ans = INF

        x = ni()

        idxs = bisect.bisect_left(s, x)
        a1 = disLR(s, idxs)

        idxt = bisect.bisect_left(t, x)
        a2 = disLR(t, idxt)

        for ta1 in a1:
            for ta2 in a2:
                tmp1 = abs(x - ta1) + abs(ta2 - ta1)
                tmp2 = abs(x - ta2) + abs(ta1 - ta2)
                ans = min(ans, tmp1, tmp2)

        print(ans) main INF = 10 ** 16 10 ** 16 INF ni = lambda: int(sys.stdin.readline()) lambda: int(sys.stdin.readline()) ni na1 = lambda: list(map(lambda x: int(x) - 1, sys.stdin.readline().split())) lambda: list(map(lambda x: int(x) - 1, sys.stdin.readline().split())) na1 MOD = 10 ** 9 + 7 10 ** 9 + 7 MOD
import sys
import re
import math
import collections
import bisect
import itertools
import fractions
import functools
import copy
import heapq
import decimal
import statistics
import queue

# import numpy as np

sys.setrecursionlimit(10 ** 9)
INF = 10 ** 16
MOD = 10 ** 9 + 7
# MOD = 998244353

ni = lambda: int(sys.stdin.readline())
ns = lambda: map(int, sys.stdin.readline().split())
na = lambda: list(map(int, sys.stdin.readline().split()))
na1 = lambda: list(map(lambda x: int(x) - 1, sys.stdin.readline().split()))


# ===CODE===



def main():
    a, b, q = ns()
    s = [ni() for _ in range(a)]
    t = [ni() for _ in range(b)]

    def disLR(a, idx):
        small = a[max(0, idx - 1)]
        large = a[min(len(a) - 1, idx)]
        return [small, large]

    for _ in range(q):
        ans = INF

        x = ni()

        idxs = bisect.bisect_left(s, x)
        a1 = disLR(s, idxs)

        idxt = bisect.bisect_left(t, x)
        a2 = disLR(t, idxt)

        for ta1 in a1:
            for ta2 in a2:
                tmp1 = abs(x - ta1) + abs(ta2 - ta1)
                tmp2 = abs(x - ta2) + abs(ta1 - ta2)
                ans = min(ans, tmp1, tmp2)

        print(ans)


if __name__ == '__main__':
    main()
