import bisect
a,b,q = map(int,input().split())
s = [int(input()) for _ in range(a)]
t = [int(input()) for _ in range(b)]
for i in range(q):
    x = int(input())
    index1 = bisect.bisect(s,x)
    index2 = bisect.bisect(t,x)
    cands = []
    if index1 != 0:
        sl = x-s[index1-1]
    if index1 != a:
        sr = s[index1]-x
    if index2 != 0:
        tl = x-t[index2-1]
    if index2 != b:
        tr = t[index2]-x
    if index1 != 0:
        if index2 != 0:
            cands.append(max(sl,tl))
        if index2 != b:
            cands.append(sl*2+tr)
            cands.append(tr*2+sl)
    if index1 != a:
        if index2 != 0:
            cands.append(sr*2+tl)
            cands.append(sr+tl*2)
        if index2 != b:
            cands.append(max(sr,tr))
    print(min(cands)) import bisect bisect a,b,q = map(int,input().split()) a map(int,input().split()) map int input().split() ().split () input split b q int(input()) for _ in range(a) for _ in range(a) _ range(a) range a for _ in range(a) int(input()) int input() input s = [int(input()) for _ in range(a)] s [int(input()) for _ in range(a)] int(input()) for _ in range(b) for _ in range(b) _ range(b) range b for _ in range(b) int(input()) int input() input t = [int(input()) for _ in range(b)] t [int(input()) for _ in range(b)] for i in range(q):
    x = int(input())
    index1 = bisect.bisect(s,x)
    index2 = bisect.bisect(t,x)
    cands = []
    if index1 != 0:
        sl = x-s[index1-1]
    if index1 != a:
        sr = s[index1]-x
    if index2 != 0:
        tl = x-t[index2-1]
    if index2 != b:
        tr = t[index2]-x
    if index1 != 0:
        if index2 != 0:
            cands.append(max(sl,tl))
        if index2 != b:
            cands.append(sl*2+tr)
            cands.append(tr*2+sl)
    if index1 != a:
        if index2 != 0:
            cands.append(sr*2+tl)
            cands.append(sr+tl*2)
        if index2 != b:
            cands.append(max(sr,tr))
    print(min(cands)) i range(q) range q x = int(input()) x int(input()) int input() input index1 = bisect.bisect(s,x) index1 bisect.bisect(s,x) bisect.bisect bisect bisect s x index2 = bisect.bisect(t,x) index2 bisect.bisect(t,x) bisect.bisect bisect bisect t x cands = [] cands [] if index1 != 0:
        sl = x-s[index1-1]
     index1 != 0 index1 0 sl = x-s[index1-1] sl x-s[index1-1] x s[index1-1] s index1-1 index1 1 if index1 != a:
        sr = s[index1]-x
     index1 != a index1 a sr = s[index1]-x sr s[index1]-x s[index1] s index1 x if index2 != 0:
        tl = x-t[index2-1]
     index2 != 0 index2 0 tl = x-t[index2-1] tl x-t[index2-1] x t[index2-1] t index2-1 index2 1 if index2 != b:
        tr = t[index2]-x
     index2 != b index2 b tr = t[index2]-x tr t[index2]-x t[index2] t index2 x if index1 != 0:
        if index2 != 0:
            cands.append(max(sl,tl))
        if index2 != b:
            cands.append(sl*2+tr)
            cands.append(tr*2+sl)
     index1 != 0 index1 0 if index2 != 0:
            cands.append(max(sl,tl))
         index2 != 0 index2 0 cands.append(max(sl,tl)) cands.append cands append max(sl,tl) max sl tl if index2 != b:
            cands.append(sl*2+tr)
            cands.append(tr*2+sl)
     index2 != b index2 b cands.append(sl*2+tr) cands.append cands append sl*2+tr sl*2 sl 2 tr cands.append(tr*2+sl) cands.append cands append tr*2+sl tr*2 tr 2 sl if index1 != a:
        if index2 != 0:
            cands.append(sr*2+tl)
            cands.append(sr+tl*2)
        if index2 != b:
            cands.append(max(sr,tr))
     index1 != a index1 a if index2 != 0:
            cands.append(sr*2+tl)
            cands.append(sr+tl*2)
         index2 != 0 index2 0 cands.append(sr*2+tl) cands.append cands append sr*2+tl sr*2 sr 2 tl cands.append(sr+tl*2) cands.append cands append sr+tl*2 sr tl*2 tl 2 if index2 != b:
            cands.append(max(sr,tr))
     index2 != b index2 b cands.append(max(sr,tr)) cands.append cands append max(sr,tr) max sr tr print(min(cands)) print min(cands) min cands q = map(int,input().split()) map(int,input().split()) q t = [int(input()) for _ in range(b)] [int(input()) for _ in range(b)] t sr = s[index1]-x s[index1]-x sr x = int(input()) int(input()) x cands = [] [] cands tl = x-t[index2-1] x-t[index2-1] tl sl = x-s[index1-1] x-s[index1-1] sl index1 = bisect.bisect(s,x) bisect.bisect(s,x) index1 a,b,q = map(int,input().split()) map(int,input().split()) a index2 = bisect.bisect(t,x) bisect.bisect(t,x) index2 tr = t[index2]-x t[index2]-x tr s = [int(input()) for _ in range(a)] [int(input()) for _ in range(a)] s b,q = map(int,input().split()) map(int,input().split()) b
import bisect
a,b,q = map(int,input().split())
s = [int(input()) for _ in range(a)]
t = [int(input()) for _ in range(b)]
for i in range(q):
    x = int(input())
    index1 = bisect.bisect(s,x)
    index2 = bisect.bisect(t,x)
    cands = []
    if index1 != 0:
        sl = x-s[index1-1]
    if index1 != a:
        sr = s[index1]-x
    if index2 != 0:
        tl = x-t[index2-1]
    if index2 != b:
        tr = t[index2]-x
    if index1 != 0:
        if index2 != 0:
            cands.append(max(sl,tl))
        if index2 != b:
            cands.append(sl*2+tr)
            cands.append(tr*2+sl)
    if index1 != a:
        if index2 != 0:
            cands.append(sr*2+tl)
            cands.append(sr+tl*2)
        if index2 != b:
            cands.append(max(sr,tr))
    print(min(cands))