import sys

from bisect import bisect_left

read = sys.stdin.read

readline = sys.stdin.readline

readlines = sys.stdin.readlines



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

stx = list(map(int, read().split()))

s = stx[:A]; t = stx[A:-Q]; x = stx[-Q:]

s = [-10 ** 10] + s + [10 ** 11]

t = [-10 ** 10] + t + [10 ** 11]



for i in x:

    ax = bisect_left(s, i)

    bx = bisect_left(t, i)

    pp = max(s[ax], t[bx]) - i

    mm = i - min(s[ax - 1], t[bx - 1])

    pm = min(s[ax] * 2 - i - t[bx - 1], t[bx] * 2 - i - s[ax - 1])

    mp = min(i - s[ax - 1] * 2 + t[bx], i - t[bx - 1] * 2 + s[ax])

    print((min(pp, mm, pm, mp)))
import sys

from bisect import bisect_left

read = sys.stdin.read

readline = sys.stdin.readline

readlines = sys.stdin.readlines





def main():

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

    stx = list(map(int, read().split()))

    s = stx[:A]; t = stx[A:-Q]; x = stx[-Q:]

    s = [-10 ** 10] + s + [10 ** 11]

    t = [-10 ** 10] + t + [10 ** 11]



    for i in x:

        ax = bisect_left(s, i)

        bx = bisect_left(t, i)

        pp = max(s[ax], t[bx]) - i

        mm = i - min(s[ax - 1], t[bx - 1])

        pm = min(s[ax] * 2 - i - t[bx - 1], t[bx] * 2 - i - s[ax - 1])

        mp = min(i - s[ax - 1] * 2 + t[bx], i - t[bx - 1] * 2 + s[ax])

        print((min(pp, mm, pm, mp)))





if __name__ == '__main__':

    main()
import sys
from bisect import bisect_left

read = sys.stdin.read
readline = sys.stdin.readline
readlines = sys.stdin.readlines
A, B, Q = list(map(int, readline().split()))
stx = list(map(int, read().split()))
s = stx[:A]
t = stx[A:-Q]
x = stx[-Q:]
s = [-(10**10)] + s + [10**11]
t = [-(10**10)] + t + [10**11]
for i in x:
    ax = bisect_left(s, i)
    bx = bisect_left(t, i)
    pp = max(s[ax], t[bx]) - i
    mm = i - min(s[ax - 1], t[bx - 1])
    pm = min(s[ax] * 2 - i - t[bx - 1], t[bx] * 2 - i - s[ax - 1])
    mp = min(i - s[ax - 1] * 2 + t[bx], i - t[bx - 1] * 2 + s[ax])
    print((min(pp, mm, pm, mp)))

import sys
from bisect import bisect_left

read = sys.stdin.read
readline = sys.stdin.readline
readlines = sys.stdin.readlines


def main():
    A, B, Q = list(map(int, readline().split()))
    stx = list(map(int, read().split()))
    s = stx[:A]
    t = stx[A:-Q]
    x = stx[-Q:]
    s = [-(10**10)] + s + [10**11]
    t = [-(10**10)] + t + [10**11]
    for i in x:
        ax = bisect_left(s, i)
        bx = bisect_left(t, i)
        pp = max(s[ax], t[bx]) - i
        mm = i - min(s[ax - 1], t[bx - 1])
        pm = min(s[ax] * 2 - i - t[bx - 1], t[bx] * 2 - i - s[ax - 1])
        mp = min(i - s[ax - 1] * 2 + t[bx], i - t[bx - 1] * 2 + s[ax])
        print((min(pp, mm, pm, mp)))


if __name__ == "__main__":
    main()

-A, B, Q = list(map(int, readline().split())) -stx = list(map(int, read().split())) -s = stx[:A] -t = stx[A:-Q] -x = stx[-Q:] -s = [-(10**10)] + s + [10**11] -t = [-(10**10)] + t + [10**11] -for i in x: -    ax = bisect_left(s, i) -    bx = bisect_left(t, i) -    pp = max(s[ax], t[bx]) - i -    mm = i - min(s[ax - 1], t[bx - 1]) -    pm = min(s[ax] * 2 - i - t[bx - 1], t[bx] * 2 - i - s[ax - 1]) -    mp = min(i - s[ax - 1] * 2 + t[bx], i - t[bx - 1] * 2 + s[ax]) -    print((min(pp, mm, pm, mp))) + + +def main(): +    A, B, Q = list(map(int, readline().split())) +    stx = list(map(int, read().split())) +    s = stx[:A] +    t = stx[A:-Q] +    x = stx[-Q:] +    s = [-(10**10)] + s + [10**11] +    t = [-(10**10)] + t + [10**11] +    for i in x: +        ax = bisect_left(s, i) +        bx = bisect_left(t, i) +        pp = max(s[ax], t[bx]) - i +        mm = i - min(s[ax - 1], t[bx - 1]) +        pm = min(s[ax] * 2 - i - t[bx - 1], t[bx] * 2 - i - s[ax - 1]) +        mp = min(i - s[ax - 1] * 2 + t[bx], i - t[bx - 1] * 2 + s[ax]) +        print((min(pp, mm, pm, mp))) + + +if __name__ == "__main__": +    main()