jin,ter,q=map(int,input().split())
INF=10**19
jil,tel=[-INF]+[int(input()) for i in range(jin)]+[INF],[-INF]+[int(input()) for i in range(ter)]+[INF]
from bisect import bisect_right as bl
for _ in range(q):
    x=int(input())
    ans=INF
    b,d=bl(jil,x),bl(tel,x)
    for s in jil[b-1:b+1]:
        for t in tel[d-1:d+1]:
            ans=min(min(abs(x-s),abs(t-x))+abs(t-s),ans)
    print(ans) jin,ter,q=map(int,input().split()) jin map(int,input().split()) map int input().split() ().split () input split ter q INF=10**19 INF 10**19 10 19 int(input()) for i in range(jin) for i in range(jin) i range(jin) range jin for i in range(jin) int(input()) int input() input jil,tel=[-INF]+[int(input()) for i in range(jin)]+[INF],[-INF]+[int(input()) for i in range(ter)]+[INF] jil [-INF]+[int(input()) for i in range(jin)]+[INF] [-INF]+[int(input()) for i in range(jin)] [-INF] -INF INF [int(input()) for i in range(jin)] [INF] INF tel [-INF]+[int(input()) for i in range(ter)]+[INF] [-INF]+[int(input()) for i in range(ter)] [-INF] -INF INF [int(input()) for i in range(ter)] [INF] INF from bisect import bisect_right as bl for _ in range(q):
    x=int(input())
    ans=INF
    b,d=bl(jil,x),bl(tel,x)
    for s in jil[b-1:b+1]:
        for t in tel[d-1:d+1]:
            ans=min(min(abs(x-s),abs(t-x))+abs(t-s),ans)
    print(ans) _ range(q) range q x=int(input()) x int(input()) int input() input ans=INF ans INF b,d=bl(jil,x),bl(tel,x) b bl(jil,x) bl jil x d bl(tel,x) bl tel x for s in jil[b-1:b+1]:
        for t in tel[d-1:d+1]:
            ans=min(min(abs(x-s),abs(t-x))+abs(t-s),ans)
     s jil[b-1:b+1] jil b-1:b+1 b-1 b 1 b+1 b 1 for t in tel[d-1:d+1]:
            ans=min(min(abs(x-s),abs(t-x))+abs(t-s),ans)
     t tel[d-1:d+1] tel d-1:d+1 d-1 d 1 d+1 d 1 ans=min(min(abs(x-s),abs(t-x))+abs(t-s),ans) ans min(min(abs(x-s),abs(t-x))+abs(t-s),ans) min min(abs(x-s),abs(t-x))+abs(t-s) min(abs(x-s),abs(t-x)) min abs(x-s) abs x-s x s abs(t-x) abs t-x t x abs(t-s) abs t-s t s ans print(ans) print ans ans=INF INF ans ans=min(min(abs(x-s),abs(t-x))+abs(t-s),ans) min(min(abs(x-s),abs(t-x))+abs(t-s),ans) ans b,d=bl(jil,x),bl(tel,x) bl(jil,x) b ter,q=map(int,input().split()) map(int,input().split()) ter jil,tel=[-INF]+[int(input()) for i in range(jin)]+[INF],[-INF]+[int(input()) for i in range(ter)]+[INF] [-INF]+[int(input()) for i in range(jin)]+[INF] jil d=bl(jil,x),bl(tel,x) bl(tel,x) d q=map(int,input().split()) map(int,input().split()) q tel=[-INF]+[int(input()) for i in range(jin)]+[INF],[-INF]+[int(input()) for i in range(ter)]+[INF] [-INF]+[int(input()) for i in range(ter)]+[INF] tel jin,ter,q=map(int,input().split()) map(int,input().split()) jin INF=10**19 10**19 INF x=int(input()) int(input()) x
jin,ter,q=map(int,input().split())
INF=10**19
jil,tel=[-INF]+[int(input()) for i in range(jin)]+[INF],[-INF]+[int(input()) for i in range(ter)]+[INF]
from bisect import bisect_right as bl
for _ in range(q):
    x=int(input())
    ans=INF
    b,d=bl(jil,x),bl(tel,x)
    for s in jil[b-1:b+1]:
        for t in tel[d-1:d+1]:
            ans=min(min(abs(x-s),abs(t-x))+abs(t-s),ans)
    print(ans)