import sys
input = sys.stdin.buffer.readline

a, b, q = map(int, input().split())
S = [0]*a
T = [0]*b
for i in range(a):
    s = int(input())
    S[i] = s
for i in range(b):
    t = int(input())
    T[i] = t

S.sort()
T.sort()
S = [-10**18]+S+[10**18]
T = [-10**18]+T+[10**18]
import bisect
for i in range(q):
    x = int(input())
    ans = 10**18
    ids = bisect.bisect_right(S, x)
    idt = bisect.bisect_right(T, x)
    for ks in (-1, 0):
        for kt in (-1, 0):
            s = S[ids+ks]
            t = T[idt+kt]
            temp = min(abs(s-x)+abs(s-t), abs(t-x)+abs(s-t))
            ans = min(ans, temp)
    print(ans) import sys sys input = sys.stdin.buffer.readline input sys.stdin.buffer.readline sys.stdin.buffer sys.stdin sys stdin buffer readline a, b, q = map(int, input().split()) a map(int, input().split()) map int input().split() ().split () input split b q S = [0]*a S [0]*a [0] 0 a T = [0]*b T [0]*b [0] 0 b for i in range(a):
    s = int(input())
    S[i] = s i range(a) range a s = int(input()) s int(input()) int input() input S[i] = s S[i] S i s for i in range(b):
    t = int(input())
    T[i] = t i range(b) range b t = int(input()) t int(input()) int input() input T[i] = t T[i] T i t S.sort() S.sort S sort T.sort() T.sort T sort S = [-10**18]+S+[10**18] S [-10**18]+S+[10**18] [-10**18]+S [-10**18] -10**18 -10 18 S [10**18] 10**18 10 18 T = [-10**18]+T+[10**18] T [-10**18]+T+[10**18] [-10**18]+T [-10**18] -10**18 -10 18 T [10**18] 10**18 10 18 import bisect bisect for i in range(q):
    x = int(input())
    ans = 10**18
    ids = bisect.bisect_right(S, x)
    idt = bisect.bisect_right(T, x)
    for ks in (-1, 0):
        for kt in (-1, 0):
            s = S[ids+ks]
            t = T[idt+kt]
            temp = min(abs(s-x)+abs(s-t), abs(t-x)+abs(s-t))
            ans = min(ans, temp)
    print(ans) i range(q) range q x = int(input()) x int(input()) int input() input ans = 10**18 ans 10**18 10 18 ids = bisect.bisect_right(S, x) ids bisect.bisect_right(S, x) bisect.bisect_right bisect bisect_right S x idt = bisect.bisect_right(T, x) idt bisect.bisect_right(T, x) bisect.bisect_right bisect bisect_right T x for ks in (-1, 0):
        for kt in (-1, 0):
            s = S[ids+ks]
            t = T[idt+kt]
            temp = min(abs(s-x)+abs(s-t), abs(t-x)+abs(s-t))
            ans = min(ans, temp)
     ks (-1, 0) -1 0 for kt in (-1, 0):
            s = S[ids+ks]
            t = T[idt+kt]
            temp = min(abs(s-x)+abs(s-t), abs(t-x)+abs(s-t))
            ans = min(ans, temp)
     kt (-1, 0) -1 0 s = S[ids+ks] s S[ids+ks] S ids+ks ids ks t = T[idt+kt] t T[idt+kt] T idt+kt idt kt temp = min(abs(s-x)+abs(s-t), abs(t-x)+abs(s-t)) temp min(abs(s-x)+abs(s-t), abs(t-x)+abs(s-t)) min abs(s-x)+abs(s-t) abs(s-x) abs s-x s x abs(s-t) abs s-t s t abs(t-x)+abs(s-t) abs(t-x) abs t-x t x abs(s-t) abs s-t s t ans = min(ans, temp) ans min(ans, temp) min ans temp print(ans) print ans x = int(input()) int(input()) x temp = min(abs(s-x)+abs(s-t), abs(t-x)+abs(s-t)) min(abs(s-x)+abs(s-t), abs(t-x)+abs(s-t)) temp a, b, q = map(int, input().split()) map(int, input().split()) a S = [0]*a [0]*a S ids = bisect.bisect_right(S, x) bisect.bisect_right(S, x) ids idt = bisect.bisect_right(T, x) bisect.bisect_right(T, x) idt T = [0]*b [0]*b T t = T[idt+kt] T[idt+kt] t q = map(int, input().split()) map(int, input().split()) q s = int(input()) int(input()) s T = [-10**18]+T+[10**18] [-10**18]+T+[10**18] T ans = min(ans, temp) min(ans, temp) ans S = [-10**18]+S+[10**18] [-10**18]+S+[10**18] S input = sys.stdin.buffer.readline sys.stdin.buffer.readline input t = int(input()) int(input()) t ans = 10**18 10**18 ans s = S[ids+ks] S[ids+ks] s b, q = map(int, input().split()) map(int, input().split()) b
import sys
input = sys.stdin.buffer.readline

a, b, q = map(int, input().split())
S = [0]*a
T = [0]*b
for i in range(a):
    s = int(input())
    S[i] = s
for i in range(b):
    t = int(input())
    T[i] = t

S.sort()
T.sort()
S = [-10**18]+S+[10**18]
T = [-10**18]+T+[10**18]
import bisect
for i in range(q):
    x = int(input())
    ans = 10**18
    ids = bisect.bisect_right(S, x)
    idt = bisect.bisect_right(T, x)
    for ks in (-1, 0):
        for kt in (-1, 0):
            s = S[ids+ks]
            t = T[idt+kt]
            temp = min(abs(s-x)+abs(s-t), abs(t-x)+abs(s-t))
            ans = min(ans, temp)
    print(ans)