import sys, math, bisect
sys.setrecursionlimit(200010)

def input():
    return sys.stdin.readline()[:-1]

def main():
    A, B, Q = map(int,input().split())
    s = [-10**12] + sorted([int(input()) for k in range(A)]) + [10**12]
    t = [-10**12] + sorted([int(input()) for k in range(B)]) + [10**12]
    for _ in range(Q):
        q = int(input())
        s1 = s[bisect.bisect_left(s,q)]
        s2 = s[bisect.bisect_left(s,q)-1]
        t1 = t[bisect.bisect_left(t,q)]
        t2 = t[bisect.bisect_left(t,q)-1]
        d1 = max(q-s2,q-t2)
        d2 = max(s1-q,t1-q)
        d3 = 2*(q-s2)+t1-q
        d4 = 2*(q-t2)+s1-q
        d5 = 2*(s1-q)+q-t2
        d6 = 2*(t1-q)+q-s2
        print(min(d1,d2,d3,d4,d5,d6))

if __name__ == '__main__':
    main() import sys, math, bisect sys math bisect sys.setrecursionlimit(200010) sys.setrecursionlimit sys setrecursionlimit 200010 def input():
    return sys.stdin.readline()[:-1] input return sys.stdin.readline()[:-1] sys.stdin.readline()[:-1] sys.stdin.readline() sys.stdin.readline sys.stdin sys stdin readline :-1 -1 def main():
    A, B, Q = map(int,input().split())
    s = [-10**12] + sorted([int(input()) for k in range(A)]) + [10**12]
    t = [-10**12] + sorted([int(input()) for k in range(B)]) + [10**12]
    for _ in range(Q):
        q = int(input())
        s1 = s[bisect.bisect_left(s,q)]
        s2 = s[bisect.bisect_left(s,q)-1]
        t1 = t[bisect.bisect_left(t,q)]
        t2 = t[bisect.bisect_left(t,q)-1]
        d1 = max(q-s2,q-t2)
        d2 = max(s1-q,t1-q)
        d3 = 2*(q-s2)+t1-q
        d4 = 2*(q-t2)+s1-q
        d5 = 2*(s1-q)+q-t2
        d6 = 2*(t1-q)+q-s2
        print(min(d1,d2,d3,d4,d5,d6)) main A, B, Q = map(int,input().split()) A map(int,input().split()) map int input().split() ().split () input split B Q int(input()) for k in range(A) for k in range(A) k range(A) range A for k in range(A) int(input()) int input() input s = [-10**12] + sorted([int(input()) for k in range(A)]) + [10**12] s [-10**12] + sorted([int(input()) for k in range(A)]) + [10**12] [-10**12] + sorted([int(input()) for k in range(A)]) [-10**12] -10**12 -10 12 sorted([int(input()) for k in range(A)]) sorted [int(input()) for k in range(A)] [10**12] 10**12 10 12 int(input()) for k in range(B) for k in range(B) k range(B) range B for k in range(B) int(input()) int input() input t = [-10**12] + sorted([int(input()) for k in range(B)]) + [10**12] t [-10**12] + sorted([int(input()) for k in range(B)]) + [10**12] [-10**12] + sorted([int(input()) for k in range(B)]) [-10**12] -10**12 -10 12 sorted([int(input()) for k in range(B)]) sorted [int(input()) for k in range(B)] [10**12] 10**12 10 12 for _ in range(Q):
        q = int(input())
        s1 = s[bisect.bisect_left(s,q)]
        s2 = s[bisect.bisect_left(s,q)-1]
        t1 = t[bisect.bisect_left(t,q)]
        t2 = t[bisect.bisect_left(t,q)-1]
        d1 = max(q-s2,q-t2)
        d2 = max(s1-q,t1-q)
        d3 = 2*(q-s2)+t1-q
        d4 = 2*(q-t2)+s1-q
        d5 = 2*(s1-q)+q-t2
        d6 = 2*(t1-q)+q-s2
        print(min(d1,d2,d3,d4,d5,d6)) _ range(Q) range Q q = int(input()) q int(input()) int input() input s1 = s[bisect.bisect_left(s,q)] s1 s[bisect.bisect_left(s,q)] s bisect.bisect_left(s,q) bisect.bisect_left bisect bisect_left s q s2 = s[bisect.bisect_left(s,q)-1] s2 s[bisect.bisect_left(s,q)-1] s bisect.bisect_left(s,q)-1 bisect.bisect_left(s,q) bisect.bisect_left bisect bisect_left s q 1 t1 = t[bisect.bisect_left(t,q)] t1 t[bisect.bisect_left(t,q)] t bisect.bisect_left(t,q) bisect.bisect_left bisect bisect_left t q t2 = t[bisect.bisect_left(t,q)-1] t2 t[bisect.bisect_left(t,q)-1] t bisect.bisect_left(t,q)-1 bisect.bisect_left(t,q) bisect.bisect_left bisect bisect_left t q 1 d1 = max(q-s2,q-t2) d1 max(q-s2,q-t2) max q-s2 q s2 q-t2 q t2 d2 = max(s1-q,t1-q) d2 max(s1-q,t1-q) max s1-q s1 q t1-q t1 q d3 = 2*(q-s2)+t1-q d3 2*(q-s2)+t1-q 2*(q-s2)+t1 2*(q-s2) 2 q-s2 q s2 t1 q d4 = 2*(q-t2)+s1-q d4 2*(q-t2)+s1-q 2*(q-t2)+s1 2*(q-t2) 2 q-t2 q t2 s1 q d5 = 2*(s1-q)+q-t2 d5 2*(s1-q)+q-t2 2*(s1-q)+q 2*(s1-q) 2 s1-q s1 q q t2 d6 = 2*(t1-q)+q-s2 d6 2*(t1-q)+q-s2 2*(t1-q)+q 2*(t1-q) 2 t1-q t1 q q s2 print(min(d1,d2,d3,d4,d5,d6)) print min(d1,d2,d3,d4,d5,d6) min d1 d2 d3 d4 d5 d6 if __name__ == '__main__':
    main() __name__ == '__main__' __name__ '__main__' main() main def input():
    return sys.stdin.readline()[:-1] def input():
    return sys.stdin.readline()[:-1] input def main():
    A, B, Q = map(int,input().split())
    s = [-10**12] + sorted([int(input()) for k in range(A)]) + [10**12]
    t = [-10**12] + sorted([int(input()) for k in range(B)]) + [10**12]
    for _ in range(Q):
        q = int(input())
        s1 = s[bisect.bisect_left(s,q)]
        s2 = s[bisect.bisect_left(s,q)-1]
        t1 = t[bisect.bisect_left(t,q)]
        t2 = t[bisect.bisect_left(t,q)-1]
        d1 = max(q-s2,q-t2)
        d2 = max(s1-q,t1-q)
        d3 = 2*(q-s2)+t1-q
        d4 = 2*(q-t2)+s1-q
        d5 = 2*(s1-q)+q-t2
        d6 = 2*(t1-q)+q-s2
        print(min(d1,d2,d3,d4,d5,d6)) def main():
    A, B, Q = map(int,input().split())
    s = [-10**12] + sorted([int(input()) for k in range(A)]) + [10**12]
    t = [-10**12] + sorted([int(input()) for k in range(B)]) + [10**12]
    for _ in range(Q):
        q = int(input())
        s1 = s[bisect.bisect_left(s,q)]
        s2 = s[bisect.bisect_left(s,q)-1]
        t1 = t[bisect.bisect_left(t,q)]
        t2 = t[bisect.bisect_left(t,q)-1]
        d1 = max(q-s2,q-t2)
        d2 = max(s1-q,t1-q)
        d3 = 2*(q-s2)+t1-q
        d4 = 2*(q-t2)+s1-q
        d5 = 2*(s1-q)+q-t2
        d6 = 2*(t1-q)+q-s2
        print(min(d1,d2,d3,d4,d5,d6)) main
import sys, math, bisect
sys.setrecursionlimit(200010)

def input():
    return sys.stdin.readline()[:-1]

def main():
    A, B, Q = map(int,input().split())
    s = [-10**12] + sorted([int(input()) for k in range(A)]) + [10**12]
    t = [-10**12] + sorted([int(input()) for k in range(B)]) + [10**12]
    for _ in range(Q):
        q = int(input())
        s1 = s[bisect.bisect_left(s,q)]
        s2 = s[bisect.bisect_left(s,q)-1]
        t1 = t[bisect.bisect_left(t,q)]
        t2 = t[bisect.bisect_left(t,q)-1]
        d1 = max(q-s2,q-t2)
        d2 = max(s1-q,t1-q)
        d3 = 2*(q-s2)+t1-q
        d4 = 2*(q-t2)+s1-q
        d5 = 2*(s1-q)+q-t2
        d6 = 2*(t1-q)+q-s2
        print(min(d1,d2,d3,d4,d5,d6))

if __name__ == '__main__':
    main()
