#float型を許すな
#numpyはpythonで
import sys
input = sys.stdin.readline
sys.setrecursionlimit(10**7)
from collections import Counter, deque
from collections import defaultdict
from itertools import combinations, permutations, accumulate, groupby, product
from bisect import bisect_left,bisect_right
from heapq import heapify, heappop, heappush
from math import floor, ceil,pi,factorial
from operator import itemgetter
def I(): return int(input())
def MI(): return map(int, input().split())
def LI(): return list(map(int, input().split()))
def LI2(): return [int(input()) for i in range(n)]
def MXI(): return [[LI()]for i in range(n)]
def SI(): return input().rstrip()
def printns(x): print('\n'.join(x))
def printni(x): print('\n'.join(list(map(str,x))))
inf = 10**17
mod = 10**9 + 7

a,b,q=MI()
lis1=[I() for i in range(a)]
lis2=[I() for i in range(b)]
lis1.append(inf)
lis2.append(inf)
lis1=[-inf]+lis1
lis2=[-inf]+lis2
#print(lis1)
#print(lis2)
for i in range(q):
    u=I()
    x=bisect_left(lis1,u)
    y=bisect_left(lis2,u)
    #print(u,x,y)
    Lll=u-min(lis1[x-1],lis2[y-1])
    Lrr=max(lis1[x],lis2[y])-u
    Llr1=2*(u-lis1[x-1])+(lis2[y]-u)
    Llr2=2*(lis2[y]-u)+u-lis1[x-1]
    Lrl1=2*(u-lis2[y-1])+lis1[x]-u
    Lrl2=2*(lis1[x]-u)+u-lis2[y-1]
    #print(Lll,Lrr,Lrl1,Lrl2,Llr1,Llr2)
    print(min(Lll,Lrr,Lrl1,Lrl2,Llr1,Llr2))
    
    
    
    
 import sys sys input = sys.stdin.readline input sys.stdin.readline sys.stdin sys stdin readline sys.setrecursionlimit(10**7) sys.setrecursionlimit sys setrecursionlimit 10**7 10 7 from collections import Counter, deque from collections import defaultdict from itertools import combinations, permutations, accumulate, groupby, product from bisect import bisect_left,bisect_right from heapq import heapify, heappop, heappush from math import floor, ceil,pi,factorial from operator import itemgetter def I(): return int(input()) I def MI(): return map(int, input().split()) MI def LI(): return list(map(int, input().split())) LI int(input()) for i in range(n) for i in range(n) i range(n) range n for i in range(n) int(input()) int input() input def LI2(): return [int(input()) for i in range(n)] LI2 [LI()]for i in range(n) for i in range(n) i range(n) range n for i in range(n) [LI()] LI() LI def MXI(): return [[LI()]for i in range(n)] MXI def SI(): return input().rstrip() SI def printns(x): print('\n'.join(x)) printns x x def printni(x): print('\n'.join(list(map(str,x)))) printni x x inf = 10**17 inf 10**17 10 17 mod = 10**9 + 7 mod 10**9 + 7 10**9 10 9 7 a,b,q=MI() a MI() MI b q I() for i in range(a) for i in range(a) i range(a) range a for i in range(a) I() I lis1=[I() for i in range(a)] lis1 [I() for i in range(a)] I() for i in range(b) for i in range(b) i range(b) range b for i in range(b) I() I lis2=[I() for i in range(b)] lis2 [I() for i in range(b)] lis1.append(inf) lis1.append lis1 append inf lis2.append(inf) lis2.append lis2 append inf lis1=[-inf]+lis1 lis1 [-inf]+lis1 [-inf] -inf inf lis1 lis2=[-inf]+lis2 lis2 [-inf]+lis2 [-inf] -inf inf lis2 for i in range(q):
    u=I()
    x=bisect_left(lis1,u)
    y=bisect_left(lis2,u)
    #print(u,x,y)
    Lll=u-min(lis1[x-1],lis2[y-1])
    Lrr=max(lis1[x],lis2[y])-u
    Llr1=2*(u-lis1[x-1])+(lis2[y]-u)
    Llr2=2*(lis2[y]-u)+u-lis1[x-1]
    Lrl1=2*(u-lis2[y-1])+lis1[x]-u
    Lrl2=2*(lis1[x]-u)+u-lis2[y-1]
    #print(Lll,Lrr,Lrl1,Lrl2,Llr1,Llr2)
    print(min(Lll,Lrr,Lrl1,Lrl2,Llr1,Llr2))
    
    
    
     i range(q) range q u=I() u I() I x=bisect_left(lis1,u) x bisect_left(lis1,u) bisect_left lis1 u y=bisect_left(lis2,u) y bisect_left(lis2,u) bisect_left lis2 u Lll=u-min(lis1[x-1],lis2[y-1]) Lll u-min(lis1[x-1],lis2[y-1]) u min(lis1[x-1],lis2[y-1]) min lis1[x-1] lis1 x-1 x 1 lis2[y-1] lis2 y-1 y 1 Lrr=max(lis1[x],lis2[y])-u Lrr max(lis1[x],lis2[y])-u max(lis1[x],lis2[y]) max lis1[x] lis1 x lis2[y] lis2 y u Llr1=2*(u-lis1[x-1])+(lis2[y]-u) Llr1 2*(u-lis1[x-1])+(lis2[y]-u) 2*(u-lis1[x-1]) 2 u-lis1[x-1] u lis1[x-1] lis1 x-1 x 1 lis2[y]-u lis2[y] lis2 y u Llr2=2*(lis2[y]-u)+u-lis1[x-1] Llr2 2*(lis2[y]-u)+u-lis1[x-1] 2*(lis2[y]-u)+u 2*(lis2[y]-u) 2 lis2[y]-u lis2[y] lis2 y u u lis1[x-1] lis1 x-1 x 1 Lrl1=2*(u-lis2[y-1])+lis1[x]-u Lrl1 2*(u-lis2[y-1])+lis1[x]-u 2*(u-lis2[y-1])+lis1[x] 2*(u-lis2[y-1]) 2 u-lis2[y-1] u lis2[y-1] lis2 y-1 y 1 lis1[x] lis1 x u Lrl2=2*(lis1[x]-u)+u-lis2[y-1] Lrl2 2*(lis1[x]-u)+u-lis2[y-1] 2*(lis1[x]-u)+u 2*(lis1[x]-u) 2 lis1[x]-u lis1[x] lis1 x u u lis2[y-1] lis2 y-1 y 1 print(min(Lll,Lrr,Lrl1,Lrl2,Llr1,Llr2)) print min(Lll,Lrr,Lrl1,Lrl2,Llr1,Llr2) min Lll Lrr Lrl1 Lrl2 Llr1 Llr2 def I(): return int(input()) def I(): return int(input()) I y=bisect_left(lis2,u) bisect_left(lis2,u) y lis1=[I() for i in range(a)] [I() for i in range(a)] lis1 def SI(): return input().rstrip() def SI(): return input().rstrip() SI def printns(x): print('\n'.join(x)) def printns(x): print('\n'.join(x)) printns inf = 10**17 10**17 inf mod = 10**9 + 7 10**9 + 7 mod def LI(): return list(map(int, input().split())) def LI(): return list(map(int, input().split())) LI Lrr=max(lis1[x],lis2[y])-u max(lis1[x],lis2[y])-u Lrr def LI2(): return [int(input()) for i in range(n)] def LI2(): return [int(input()) for i in range(n)] LI2 def MXI(): return [[LI()]for i in range(n)] def MXI(): return [[LI()]for i in range(n)] MXI u=I() I() u Llr1=2*(u-lis1[x-1])+(lis2[y]-u) 2*(u-lis1[x-1])+(lis2[y]-u) Llr1 a,b,q=MI() MI() a b,q=MI() MI() b q=MI() MI() q Lrl1=2*(u-lis2[y-1])+lis1[x]-u 2*(u-lis2[y-1])+lis1[x]-u Lrl1 Lrl2=2*(lis1[x]-u)+u-lis2[y-1] 2*(lis1[x]-u)+u-lis2[y-1] Lrl2 def MI(): return map(int, input().split()) def MI(): return map(int, input().split()) MI Lll=u-min(lis1[x-1],lis2[y-1]) u-min(lis1[x-1],lis2[y-1]) Lll Llr2=2*(lis2[y]-u)+u-lis1[x-1] 2*(lis2[y]-u)+u-lis1[x-1] Llr2 def printni(x): print('\n'.join(list(map(str,x)))) def printni(x): print('\n'.join(list(map(str,x)))) printni input = sys.stdin.readline sys.stdin.readline input lis2=[I() for i in range(b)] [I() for i in range(b)] lis2 lis1=[-inf]+lis1 [-inf]+lis1 lis1 x=bisect_left(lis1,u) bisect_left(lis1,u) x lis2=[-inf]+lis2 [-inf]+lis2 lis2
#float型を許すな
#numpyはpythonで
import sys
input = sys.stdin.readline
sys.setrecursionlimit(10**7)
from collections import Counter, deque
from collections import defaultdict
from itertools import combinations, permutations, accumulate, groupby, product
from bisect import bisect_left,bisect_right
from heapq import heapify, heappop, heappush
from math import floor, ceil,pi,factorial
from operator import itemgetter
def I(): return int(input())
def MI(): return map(int, input().split())
def LI(): return list(map(int, input().split()))
def LI2(): return [int(input()) for i in range(n)]
def MXI(): return [[LI()]for i in range(n)]
def SI(): return input().rstrip()
def printns(x): print('\n'.join(x))
def printni(x): print('\n'.join(list(map(str,x))))
inf = 10**17
mod = 10**9 + 7

a,b,q=MI()
lis1=[I() for i in range(a)]
lis2=[I() for i in range(b)]
lis1.append(inf)
lis2.append(inf)
lis1=[-inf]+lis1
lis2=[-inf]+lis2
#print(lis1)
#print(lis2)
for i in range(q):
    u=I()
    x=bisect_left(lis1,u)
    y=bisect_left(lis2,u)
    #print(u,x,y)
    Lll=u-min(lis1[x-1],lis2[y-1])
    Lrr=max(lis1[x],lis2[y])-u
    Llr1=2*(u-lis1[x-1])+(lis2[y]-u)
    Llr2=2*(lis2[y]-u)+u-lis1[x-1]
    Lrl1=2*(u-lis2[y-1])+lis1[x]-u
    Lrl2=2*(lis1[x]-u)+u-lis2[y-1]
    #print(Lll,Lrr,Lrl1,Lrl2,Llr1,Llr2)
    print(min(Lll,Lrr,Lrl1,Lrl2,Llr1,Llr2))
    
    
    
    

