#!/usr/bin/env python

# coding: utf-8



import sys

input = sys.stdin.readline



inf = float('inf')



def main():

    A, B, Q = list(map(int, input().split()))

    ls = [-inf] + [int(eval(input())) for _ in range(A)] + [inf]

    lt = [-inf] + [int(eval(input())) for _ in range(B)] + [inf]

    lx = [(int(eval(input())), i) for i in range(Q)]

    ls.sort()

    lt.sort()

    lx.sort()

    ans = {}

    s = 1

    t = 1

    for i in range(Q):

        dist = -1

        x = lx[i][0]

        while s <= A and ls[s] < x:

            s += 1

        while t <= B and lt[t] < x:

            t += 1

        s_min = ls[s-1]

        s_max = ls[s]

        t_min = lt[t-1]

        t_max = lt[t]

        d = min(max(s_max-x, t_max-x),

                (s_max-x)*2 + (x-t_min),

                (t_max-x)*2 + (x-s_min),

                (s_max-x) + (x-t_min)*2,

                (t_max-x) + (x-s_min)*2,

                max(x-s_min,x-t_min))

        ans[lx[i][1]] = d

    for i in range(Q):

        print((ans[i]))





if __name__ == '__main__':

    main()

#!/usr/bin/env python

# coding: utf-8



import sys

input = sys.stdin.readline



inf = float('inf')



def main():

    A, B, Q = list(map(int, input().split()))

    ls = [-inf] + [int(eval(input())) for _ in range(A)] + [inf]

    lt = [-inf] + [int(eval(input())) for _ in range(B)] + [inf]

    lx = [(int(eval(input())), i) for i in range(Q)]

    ls.sort()

    lt.sort()

    lx.sort()

    ans = {}

    s = 1

    t = 1

    for i in range(Q):

        dist = -1

        x = lx[i][0]

        while s <= A and ls[s] < x:

            s += 1

        while t <= B and lt[t] < x:

            t += 1

        s_min = ls[s-1]

        s_max = ls[s]

        t_min = lt[t-1]

        t_max = lt[t]

        d = min(max(s_max-x, t_max-x),

                (s_max-x)*2 + (x-t_min),

                (t_max-x)*2 + (x-s_min),

                (s_max-x) + (x-t_min)*2,

                (t_max-x) + (x-s_min)*2,

                max(x-s_min,x-t_min))

        ans[lx[i][1]] = str(d)

    print(("\n".join(ans[i] for i in range(Q))))





if __name__ == '__main__':

    main()

#!/usr/bin/env python
# coding: utf-8
import sys

input = sys.stdin.readline
inf = float("inf")


def main():
    A, B, Q = list(map(int, input().split()))
    ls = [-inf] + [int(eval(input())) for _ in range(A)] + [inf]
    lt = [-inf] + [int(eval(input())) for _ in range(B)] + [inf]
    lx = [(int(eval(input())), i) for i in range(Q)]
    ls.sort()
    lt.sort()
    lx.sort()
    ans = {}
    s = 1
    t = 1
    for i in range(Q):
        dist = -1
        x = lx[i][0]
        while s <= A and ls[s] < x:
            s += 1
        while t <= B and lt[t] < x:
            t += 1
        s_min = ls[s - 1]
        s_max = ls[s]
        t_min = lt[t - 1]
        t_max = lt[t]
        d = min(
            max(s_max - x, t_max - x),
            (s_max - x) * 2 + (x - t_min),
            (t_max - x) * 2 + (x - s_min),
            (s_max - x) + (x - t_min) * 2,
            (t_max - x) + (x - s_min) * 2,
            max(x - s_min, x - t_min),
        )
        ans[lx[i][1]] = d
    for i in range(Q):
        print((ans[i]))


if __name__ == "__main__":
    main()

#!/usr/bin/env python
# coding: utf-8
import sys

input = sys.stdin.readline
inf = float("inf")


def main():
    A, B, Q = list(map(int, input().split()))
    ls = [-inf] + [int(eval(input())) for _ in range(A)] + [inf]
    lt = [-inf] + [int(eval(input())) for _ in range(B)] + [inf]
    lx = [(int(eval(input())), i) for i in range(Q)]
    ls.sort()
    lt.sort()
    lx.sort()
    ans = {}
    s = 1
    t = 1
    for i in range(Q):
        dist = -1
        x = lx[i][0]
        while s <= A and ls[s] < x:
            s += 1
        while t <= B and lt[t] < x:
            t += 1
        s_min = ls[s - 1]
        s_max = ls[s]
        t_min = lt[t - 1]
        t_max = lt[t]
        d = min(
            max(s_max - x, t_max - x),
            (s_max - x) * 2 + (x - t_min),
            (t_max - x) * 2 + (x - s_min),
            (s_max - x) + (x - t_min) * 2,
            (t_max - x) + (x - s_min) * 2,
            max(x - s_min, x - t_min),
        )
        ans[lx[i][1]] = str(d)
    print(("\n".join(ans[i] for i in range(Q))))


if __name__ == "__main__":
    main()

-        ans[lx[i][1]] = d -    for i in range(Q): -        print((ans[i])) +        ans[lx[i][1]] = str(d) +    print(("\n".join(ans[i] for i in range(Q))))