program test

implicit none
integer(8),parameter :: inf=1d17,inf_minus=-1d17
integer(8) :: a,b,q,i,j
integer(8) :: s(200000),t(200000),x(200000),sx(200000),tx(200000),ans1,ans2,ans3,ans4,ans
integer(8) :: sx2(200000),tx2(200000)
integer(8) :: s_left(200000),s_right(200000),t_left(200000),t_right(200000),s_l,s_r,t_l,t_r

read(*,*) a,b,q
do i=1,a
	read(*,*) s(i)
	sx(i)=s(i)
	sx2(i)=0
enddo
do i=1,b
	read(*,*) t(i)
	tx(i)=t(i)
	tx2(i)=0
enddo
do i=1,q
	read(*,*) x(i)
	sx(a+i)=x(i)
	tx(b+i)=x(i)
	sx2(a+i)=i
	tx2(b+i)=i
enddo

call heapsort_up(a+q,sx(1:(a+q)),sx2(1:(a+q)))
call heapsort_up(b+q,tx(1:(b+q)),tx2(1:(b+q)))

s_l = inf_minus
s_r = inf
t_l = inf_minus
t_r = inf

do i=1,(a+q)
	if(sx2(i) == 0)then
		s_l = sx(i)
	else
		s_left(sx2(i)) = abs(s_l - x(sx2(i)))
	endif
enddo

do i=(a+q),1,-1
	if(sx2(i) == 0)then
		s_r = sx(i)
	else
		s_right(sx2(i)) = abs(s_r - x(sx2(i)))
	endif
enddo

do i=1,(b+q)
	if(tx2(i) == 0)then
		t_l = tx(i)
	else
		t_left(tx2(i)) = abs(t_l - x(tx2(i)))
	endif
enddo

do i=(b+q),1,-1
	if(tx2(i) == 0)then
		t_r = tx(i)
	else
		t_right(tx2(i)) = abs(t_r - x(tx2(i)))
	endif
enddo

do i=1,q
	ans1= max(s_left(i),t_left(i))
	ans2= max(s_right(i),t_right(i))
	ans3= min(s_left(i)+2*t_right(i),2*s_left(i)+t_right(i))
	ans4= min(t_left(i)+2*s_right(i),2*t_left(i)+s_right(i))
	ans=min(ans1,ans2,ans3,ans4)
	write(*,*) ans
enddo


contains
 
subroutine heapsort_down(n,y1,y2)
 
	implicit none
	integer(8),intent(in) :: n
	integer(8),intent(inout) :: y1(1:n)
	integer(8),intent(inout) :: y2(1:n)
	integer(8) :: i,k,j,l
	integer(8) :: t1,t2
	
	l = n/2+1
	k = n
 
	do while (k /= 1)
		 if(l > 1) then
				l = l-1
				t1 = y1(l)
				t2 = y2(l)
				
		 else
				t1 = y1(k)
				t2 = y2(k)
				y1(k) = y1(1)
				y2(k) = y2(1)
				k = k-1
				if(k == 1) then
					 y1(1) = t1
					 y2(1) = t2
					 exit
				endif
		 endif
 
		 i = l
		 j = l+l
 
		 do while(j <= k)
				if(j < k) then
					 if(y1(j) > y1(j+1)) j = j+1
				endif
				
				if (t1 > y1(j)) then
					 y1(i) = y1(j)
					 y2(i) = y2(j)
					 i = j
					 j = j+j
				else
					 j = k+1
				endif
		 
		 enddo
		 
		 y1(i) = t1
		 y2(i) = t2
	
	enddo
	return
 
end subroutine heapsort_down

subroutine heapsort_up(n,y1,y2)
 
	implicit none
	integer(8),intent(in) :: n
	integer(8),intent(inout) :: y1(1:n)
	integer(8),intent(inout) :: y2(1:n)
	integer(8) :: i,k,j,l
	integer(8) :: t1,t2
	
	l = n/2+1
	k = n
 
	do while (k /= 1)
		 if(l > 1) then
				l = l-1
				t1 = y1(l)
				t2 = y2(l)
				
		 else
				t1 = y1(k)
				t2 = y2(k)
				y1(k) = y1(1)
				y2(k) = y2(1)
				k = k-1
				if(k == 1) then
					 y1(1) = t1
					 y2(1) = t2
					 exit
				endif
		 endif
 
		 i = l
		 j = l+l
 
		 do while(j <= k)
				if(j < k) then
					 if(y1(j) < y1(j+1)) j = j+1
				endif
				
				if (t1 < y1(j)) then
					 y1(i) = y1(j)
					 y2(i) = y2(j)
					 i = j
					 j = j+j
				else
					 j = k+1
				endif
		 
		 enddo
		 
		 y1(i) = t1
		 y2(i) = t2
	
	enddo
	return
 
end subroutine heapsort_up

end program