import sys
input = sys.stdin.readline
import bisect

a,b,q = map(int, input().split())
INF = 10**18
s = [-INF] + [int(input()) for _ in range(a)] + [INF]
t = [-INF] + [int(input()) for _ in range(b)] + [INF]
for _ in range(q):
    x = int(input())
    i = bisect.bisect_right(s,x)
    j = bisect.bisect_right(t,x)
    d = INF
    for si in [s[i-1],s[i]]:
        for ti in [t[j-1],t[j]]:
            d1 = abs(x-si)+abs(ti-si)
            d2 = abs(x-ti)+abs(ti-si)
            d = min(d,d1,d2)
    print(d) import sys sys input = sys.stdin.readline input sys.stdin.readline sys.stdin sys stdin readline import bisect bisect a,b,q = map(int, input().split()) a map(int, input().split()) map int input().split() ().split () input split b q INF = 10**18 INF 10**18 10 18 int(input()) for _ in range(a) for _ in range(a) _ range(a) range a for _ in range(a) int(input()) int input() input s = [-INF] + [int(input()) for _ in range(a)] + [INF] s [-INF] + [int(input()) for _ in range(a)] + [INF] [-INF] + [int(input()) for _ in range(a)] [-INF] -INF INF [int(input()) for _ in range(a)] [INF] INF int(input()) for _ in range(b) for _ in range(b) _ range(b) range b for _ in range(b) int(input()) int input() input t = [-INF] + [int(input()) for _ in range(b)] + [INF] t [-INF] + [int(input()) for _ in range(b)] + [INF] [-INF] + [int(input()) for _ in range(b)] [-INF] -INF INF [int(input()) for _ in range(b)] [INF] INF for _ in range(q):
    x = int(input())
    i = bisect.bisect_right(s,x)
    j = bisect.bisect_right(t,x)
    d = INF
    for si in [s[i-1],s[i]]:
        for ti in [t[j-1],t[j]]:
            d1 = abs(x-si)+abs(ti-si)
            d2 = abs(x-ti)+abs(ti-si)
            d = min(d,d1,d2)
    print(d) _ range(q) range q x = int(input()) x int(input()) int input() input i = bisect.bisect_right(s,x) i bisect.bisect_right(s,x) bisect.bisect_right bisect bisect_right s x j = bisect.bisect_right(t,x) j bisect.bisect_right(t,x) bisect.bisect_right bisect bisect_right t x d = INF d INF for si in [s[i-1],s[i]]:
        for ti in [t[j-1],t[j]]:
            d1 = abs(x-si)+abs(ti-si)
            d2 = abs(x-ti)+abs(ti-si)
            d = min(d,d1,d2)
     si [s[i-1],s[i]] s[i-1] s i-1 i 1 s[i] s i for ti in [t[j-1],t[j]]:
            d1 = abs(x-si)+abs(ti-si)
            d2 = abs(x-ti)+abs(ti-si)
            d = min(d,d1,d2)
     ti [t[j-1],t[j]] t[j-1] t j-1 j 1 t[j] t j d1 = abs(x-si)+abs(ti-si) d1 abs(x-si)+abs(ti-si) abs(x-si) abs x-si x si abs(ti-si) abs ti-si ti si d2 = abs(x-ti)+abs(ti-si) d2 abs(x-ti)+abs(ti-si) abs(x-ti) abs x-ti x ti abs(ti-si) abs ti-si ti si d = min(d,d1,d2) d min(d,d1,d2) min d d1 d2 print(d) print d s = [-INF] + [int(input()) for _ in range(a)] + [INF] [-INF] + [int(input()) for _ in range(a)] + [INF] s INF = 10**18 10**18 INF input = sys.stdin.readline sys.stdin.readline input d1 = abs(x-si)+abs(ti-si) abs(x-si)+abs(ti-si) d1 j = bisect.bisect_right(t,x) bisect.bisect_right(t,x) j b,q = map(int, input().split()) map(int, input().split()) b d = INF INF d d2 = abs(x-ti)+abs(ti-si) abs(x-ti)+abs(ti-si) d2 i = bisect.bisect_right(s,x) bisect.bisect_right(s,x) i q = map(int, input().split()) map(int, input().split()) q d = min(d,d1,d2) min(d,d1,d2) d t = [-INF] + [int(input()) for _ in range(b)] + [INF] [-INF] + [int(input()) for _ in range(b)] + [INF] t a,b,q = map(int, input().split()) map(int, input().split()) a x = int(input()) int(input()) x
import sys
input = sys.stdin.readline
import bisect

a,b,q = map(int, input().split())
INF = 10**18
s = [-INF] + [int(input()) for _ in range(a)] + [INF]
t = [-INF] + [int(input()) for _ in range(b)] + [INF]
for _ in range(q):
    x = int(input())
    i = bisect.bisect_right(s,x)
    j = bisect.bisect_right(t,x)
    d = INF
    for si in [s[i-1],s[i]]:
        for ti in [t[j-1],t[j]]:
            d1 = abs(x-si)+abs(ti-si)
            d2 = abs(x-ti)+abs(ti-si)
            d = min(d,d1,d2)
    print(d)