a,b,q = map(int, input().split())

s = [int(input()) for i in range(a)]
t = [int(input()) for i in range(b)]

import bisect

for i in range(q):
    s2 = 10**12
    t2 = 10**12
    qq = int(input())
    sp = bisect.bisect(s,qq)
    tp = bisect.bisect(t,qq)
    s1 = s[sp-1]
    if sp <a:
        s2 = s[sp]

    t1 = t[tp-1]
    if tp <b:
        t2 = t[tp]
    print(min(abs(qq-s1)+abs(s1-t1),abs(qq-s1)+abs(s1-t2),
              abs(qq-s2)+abs(s2-t1),abs(qq-s2)+abs(s2-t2),
              abs(qq-t1)+abs(t1-s1),abs(qq-t1)+abs(t1-s2),
              abs(qq-t2)+abs(t2-s1),abs(qq-t2)+abs(t2-s2))) a,b,q = map(int, input().split()) a map(int, input().split()) map int input().split() ().split () input split b q int(input()) for i in range(a) for i in range(a) i range(a) range a for i in range(a) int(input()) int input() input s = [int(input()) for i in range(a)] s [int(input()) for i in range(a)] int(input()) for i in range(b) for i in range(b) i range(b) range b for i in range(b) int(input()) int input() input t = [int(input()) for i in range(b)] t [int(input()) for i in range(b)] import bisect bisect for i in range(q):
    s2 = 10**12
    t2 = 10**12
    qq = int(input())
    sp = bisect.bisect(s,qq)
    tp = bisect.bisect(t,qq)
    s1 = s[sp-1]
    if sp <a:
        s2 = s[sp]

    t1 = t[tp-1]
    if tp <b:
        t2 = t[tp]
    print(min(abs(qq-s1)+abs(s1-t1),abs(qq-s1)+abs(s1-t2),
              abs(qq-s2)+abs(s2-t1),abs(qq-s2)+abs(s2-t2),
              abs(qq-t1)+abs(t1-s1),abs(qq-t1)+abs(t1-s2),
              abs(qq-t2)+abs(t2-s1),abs(qq-t2)+abs(t2-s2))) i range(q) range q s2 = 10**12 s2 10**12 10 12 t2 = 10**12 t2 10**12 10 12 qq = int(input()) qq int(input()) int input() input sp = bisect.bisect(s,qq) sp bisect.bisect(s,qq) bisect.bisect bisect bisect s qq tp = bisect.bisect(t,qq) tp bisect.bisect(t,qq) bisect.bisect bisect bisect t qq s1 = s[sp-1] s1 s[sp-1] s sp-1 sp 1 if sp <a:
        s2 = s[sp]

     sp <a sp a s2 = s[sp] s2 s[sp] s sp t1 = t[tp-1] t1 t[tp-1] t tp-1 tp 1 if tp <b:
        t2 = t[tp]
     tp <b tp b t2 = t[tp] t2 t[tp] t tp print(min(abs(qq-s1)+abs(s1-t1),abs(qq-s1)+abs(s1-t2),
              abs(qq-s2)+abs(s2-t1),abs(qq-s2)+abs(s2-t2),
              abs(qq-t1)+abs(t1-s1),abs(qq-t1)+abs(t1-s2),
              abs(qq-t2)+abs(t2-s1),abs(qq-t2)+abs(t2-s2))) print min(abs(qq-s1)+abs(s1-t1),abs(qq-s1)+abs(s1-t2),
              abs(qq-s2)+abs(s2-t1),abs(qq-s2)+abs(s2-t2),
              abs(qq-t1)+abs(t1-s1),abs(qq-t1)+abs(t1-s2),
              abs(qq-t2)+abs(t2-s1),abs(qq-t2)+abs(t2-s2)) min abs(qq-s1)+abs(s1-t1) abs(qq-s1) abs qq-s1 qq s1 abs(s1-t1) abs s1-t1 s1 t1 abs(qq-s1)+abs(s1-t2) abs(qq-s1) abs qq-s1 qq s1 abs(s1-t2) abs s1-t2 s1 t2 abs(qq-s2)+abs(s2-t1) abs(qq-s2) abs qq-s2 qq s2 abs(s2-t1) abs s2-t1 s2 t1 abs(qq-s2)+abs(s2-t2) abs(qq-s2) abs qq-s2 qq s2 abs(s2-t2) abs s2-t2 s2 t2 abs(qq-t1)+abs(t1-s1) abs(qq-t1) abs qq-t1 qq t1 abs(t1-s1) abs t1-s1 t1 s1 abs(qq-t1)+abs(t1-s2) abs(qq-t1) abs qq-t1 qq t1 abs(t1-s2) abs t1-s2 t1 s2 abs(qq-t2)+abs(t2-s1) abs(qq-t2) abs qq-t2 qq t2 abs(t2-s1) abs t2-s1 t2 s1 abs(qq-t2)+abs(t2-s2) abs(qq-t2) abs qq-t2 qq t2 abs(t2-s2) abs t2-s2 t2 s2 q = map(int, input().split()) map(int, input().split()) q s = [int(input()) for i in range(a)] [int(input()) for i in range(a)] s t = [int(input()) for i in range(b)] [int(input()) for i in range(b)] t t1 = t[tp-1] t[tp-1] t1 t2 = 10**12 10**12 t2 t2 = t[tp] t[tp] t2 tp = bisect.bisect(t,qq) bisect.bisect(t,qq) tp s1 = s[sp-1] s[sp-1] s1 s2 = 10**12 10**12 s2 a,b,q = map(int, input().split()) map(int, input().split()) a sp = bisect.bisect(s,qq) bisect.bisect(s,qq) sp b,q = map(int, input().split()) map(int, input().split()) b qq = int(input()) int(input()) qq s2 = s[sp] s[sp] s2
a,b,q = map(int, input().split())

s = [int(input()) for i in range(a)]
t = [int(input()) for i in range(b)]

import bisect

for i in range(q):
    s2 = 10**12
    t2 = 10**12
    qq = int(input())
    sp = bisect.bisect(s,qq)
    tp = bisect.bisect(t,qq)
    s1 = s[sp-1]
    if sp <a:
        s2 = s[sp]

    t1 = t[tp-1]
    if tp <b:
        t2 = t[tp]
    print(min(abs(qq-s1)+abs(s1-t1),abs(qq-s1)+abs(s1-t2),
              abs(qq-s2)+abs(s2-t1),abs(qq-s2)+abs(s2-t2),
              abs(qq-t1)+abs(t1-s1),abs(qq-t1)+abs(t1-s2),
              abs(qq-t2)+abs(t2-s1),abs(qq-t2)+abs(t2-s2)))