import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
from bisect import bisect

a,b,q = map(int,readline().split())
s = [int(readline()) for i in range(a)]
t = [int(readline()) for i in range(b)]

for i in range(q):
  x = int(input())
  ss = bisect(s,x)
  if ss == 0:
    sR = s[0]
    sL = s[0]
  elif ss == len(s):
    sR = s[-1]
    sL = s[-1]
  else:
    sR = s[ss]
    sL = s[ss-1]
    
  sRt = bisect(t,sR)
  sLt = bisect(t,sL)
  if sRt == 0:
    sRtL = t[0]
  else:
    sRtL = t[sRt-1]
  if sLt == len(t):
    sLtR = t[-1]
  else:
    sLtR = t[sLt]
  if sRt == len(t):
    sRtR = t[-1]
  else:
    sRtR = t[sRt]
  if sLt == 0:
    sLtL = t[0]
  else:
    sLtL = t[sLt-1]
  chk = min(abs(x-sL)+abs(sL-sLtL),abs(x-sL)+abs(sL-sLtR),abs(x-sR)+abs(sR-sRtR),abs(x-sR)+abs(sR-sRtL))
  ss = bisect(t,x)
  if ss == 0:
    sR = t[0]
    sL = t[0]
  elif ss == len(t):
    sR = t[-1]
    sL = t[-1]
  else:
    sR = t[ss]
    sL = t[ss-1]
  sRt = bisect(s,sR)
  sLt = bisect(s,sL)
  if sRt == 0:
    sRtL = s[0]
  else:
    sRtL = s[sRt-1]
  if sLt == len(s):
    sLtR = s[-1]
  else:
    sLtR = s[sLt]
  if sRt == len(s):
    sRtR = s[-1]
  else:
    sRtR = s[sRt]
  if sLt == 0:
    sLtL = s[0]
  else:
    sLtL = s[sLt-1]  
  chk = min(chk,abs(x-sL)+abs(sL-sLtL),abs(x-sL)+abs(sL-sLtR),abs(x-sR)+abs(sR-sRtR),abs(x-sR)+abs(sR-sRtL))
  print(chk) import sys sys read = sys.stdin.buffer.read read sys.stdin.buffer.read sys.stdin.buffer sys.stdin sys stdin buffer read readline = sys.stdin.buffer.readline readline sys.stdin.buffer.readline sys.stdin.buffer sys.stdin sys stdin buffer readline readlines = sys.stdin.buffer.readlines readlines sys.stdin.buffer.readlines sys.stdin.buffer sys.stdin sys stdin buffer readlines from bisect import bisect a,b,q = map(int,readline().split()) a map(int,readline().split()) map int readline().split() ().split () readline split b q int(readline()) for i in range(a) for i in range(a) i range(a) range a for i in range(a) int(readline()) int readline() readline s = [int(readline()) for i in range(a)] s [int(readline()) for i in range(a)] int(readline()) for i in range(b) for i in range(b) i range(b) range b for i in range(b) int(readline()) int readline() readline t = [int(readline()) for i in range(b)] t [int(readline()) for i in range(b)] for i in range(q):
  x = int(input())
  ss = bisect(s,x)
  if ss == 0:
    sR = s[0]
    sL = s[0]
  elif ss == len(s):
    sR = s[-1]
    sL = s[-1]
  else:
    sR = s[ss]
    sL = s[ss-1]
    
  sRt = bisect(t,sR)
  sLt = bisect(t,sL)
  if sRt == 0:
    sRtL = t[0]
  else:
    sRtL = t[sRt-1]
  if sLt == len(t):
    sLtR = t[-1]
  else:
    sLtR = t[sLt]
  if sRt == len(t):
    sRtR = t[-1]
  else:
    sRtR = t[sRt]
  if sLt == 0:
    sLtL = t[0]
  else:
    sLtL = t[sLt-1]
  chk = min(abs(x-sL)+abs(sL-sLtL),abs(x-sL)+abs(sL-sLtR),abs(x-sR)+abs(sR-sRtR),abs(x-sR)+abs(sR-sRtL))
  ss = bisect(t,x)
  if ss == 0:
    sR = t[0]
    sL = t[0]
  elif ss == len(t):
    sR = t[-1]
    sL = t[-1]
  else:
    sR = t[ss]
    sL = t[ss-1]
  sRt = bisect(s,sR)
  sLt = bisect(s,sL)
  if sRt == 0:
    sRtL = s[0]
  else:
    sRtL = s[sRt-1]
  if sLt == len(s):
    sLtR = s[-1]
  else:
    sLtR = s[sLt]
  if sRt == len(s):
    sRtR = s[-1]
  else:
    sRtR = s[sRt]
  if sLt == 0:
    sLtL = s[0]
  else:
    sLtL = s[sLt-1]  
  chk = min(chk,abs(x-sL)+abs(sL-sLtL),abs(x-sL)+abs(sL-sLtR),abs(x-sR)+abs(sR-sRtR),abs(x-sR)+abs(sR-sRtL))
  print(chk) i range(q) range q x = int(input()) x int(input()) int input() input ss = bisect(s,x) ss bisect(s,x) bisect s x if ss == 0:
    sR = s[0]
    sL = s[0]
  elif ss == len(s):
    sR = s[-1]
    sL = s[-1]
  else:
    sR = s[ss]
    sL = s[ss-1]
    
   ss == 0 ss 0 sR = s[0] sR s[0] s 0 sL = s[0] sL s[0] s 0 elif ss == len(s):
    sR = s[-1]
    sL = s[-1]
   ss == len(s) ss len(s) len s sR = s[-1] sR s[-1] s -1 sL = s[-1] sL s[-1] s -1 sR = s[ss] sR s[ss] s ss sL = s[ss-1] sL s[ss-1] s ss-1 ss 1 sRt = bisect(t,sR) sRt bisect(t,sR) bisect t sR sLt = bisect(t,sL) sLt bisect(t,sL) bisect t sL if sRt == 0:
    sRtL = t[0]
  else:
    sRtL = t[sRt-1]
   sRt == 0 sRt 0 sRtL = t[0] sRtL t[0] t 0 sRtL = t[sRt-1] sRtL t[sRt-1] t sRt-1 sRt 1 if sLt == len(t):
    sLtR = t[-1]
  else:
    sLtR = t[sLt]
   sLt == len(t) sLt len(t) len t sLtR = t[-1] sLtR t[-1] t -1 sLtR = t[sLt] sLtR t[sLt] t sLt if sRt == len(t):
    sRtR = t[-1]
  else:
    sRtR = t[sRt]
   sRt == len(t) sRt len(t) len t sRtR = t[-1] sRtR t[-1] t -1 sRtR = t[sRt] sRtR t[sRt] t sRt if sLt == 0:
    sLtL = t[0]
  else:
    sLtL = t[sLt-1]
   sLt == 0 sLt 0 sLtL = t[0] sLtL t[0] t 0 sLtL = t[sLt-1] sLtL t[sLt-1] t sLt-1 sLt 1 chk = min(abs(x-sL)+abs(sL-sLtL),abs(x-sL)+abs(sL-sLtR),abs(x-sR)+abs(sR-sRtR),abs(x-sR)+abs(sR-sRtL)) chk min(abs(x-sL)+abs(sL-sLtL),abs(x-sL)+abs(sL-sLtR),abs(x-sR)+abs(sR-sRtR),abs(x-sR)+abs(sR-sRtL)) min abs(x-sL)+abs(sL-sLtL) abs(x-sL) abs x-sL x sL abs(sL-sLtL) abs sL-sLtL sL sLtL abs(x-sL)+abs(sL-sLtR) abs(x-sL) abs x-sL x sL abs(sL-sLtR) abs sL-sLtR sL sLtR abs(x-sR)+abs(sR-sRtR) abs(x-sR) abs x-sR x sR abs(sR-sRtR) abs sR-sRtR sR sRtR abs(x-sR)+abs(sR-sRtL) abs(x-sR) abs x-sR x sR abs(sR-sRtL) abs sR-sRtL sR sRtL ss = bisect(t,x) ss bisect(t,x) bisect t x if ss == 0:
    sR = t[0]
    sL = t[0]
  elif ss == len(t):
    sR = t[-1]
    sL = t[-1]
  else:
    sR = t[ss]
    sL = t[ss-1]
   ss == 0 ss 0 sR = t[0] sR t[0] t 0 sL = t[0] sL t[0] t 0 elif ss == len(t):
    sR = t[-1]
    sL = t[-1]
   ss == len(t) ss len(t) len t sR = t[-1] sR t[-1] t -1 sL = t[-1] sL t[-1] t -1 sR = t[ss] sR t[ss] t ss sL = t[ss-1] sL t[ss-1] t ss-1 ss 1 sRt = bisect(s,sR) sRt bisect(s,sR) bisect s sR sLt = bisect(s,sL) sLt bisect(s,sL) bisect s sL if sRt == 0:
    sRtL = s[0]
  else:
    sRtL = s[sRt-1]
   sRt == 0 sRt 0 sRtL = s[0] sRtL s[0] s 0 sRtL = s[sRt-1] sRtL s[sRt-1] s sRt-1 sRt 1 if sLt == len(s):
    sLtR = s[-1]
  else:
    sLtR = s[sLt]
   sLt == len(s) sLt len(s) len s sLtR = s[-1] sLtR s[-1] s -1 sLtR = s[sLt] sLtR s[sLt] s sLt if sRt == len(s):
    sRtR = s[-1]
  else:
    sRtR = s[sRt]
   sRt == len(s) sRt len(s) len s sRtR = s[-1] sRtR s[-1] s -1 sRtR = s[sRt] sRtR s[sRt] s sRt if sLt == 0:
    sLtL = s[0]
  else:
    sLtL = s[sLt-1]  
   sLt == 0 sLt 0 sLtL = s[0] sLtL s[0] s 0 sLtL = s[sLt-1] sLtL s[sLt-1] s sLt-1 sLt 1 chk = min(chk,abs(x-sL)+abs(sL-sLtL),abs(x-sL)+abs(sL-sLtR),abs(x-sR)+abs(sR-sRtR),abs(x-sR)+abs(sR-sRtL)) chk min(chk,abs(x-sL)+abs(sL-sLtL),abs(x-sL)+abs(sL-sLtR),abs(x-sR)+abs(sR-sRtR),abs(x-sR)+abs(sR-sRtL)) min chk abs(x-sL)+abs(sL-sLtL) abs(x-sL) abs x-sL x sL abs(sL-sLtL) abs sL-sLtL sL sLtL abs(x-sL)+abs(sL-sLtR) abs(x-sL) abs x-sL x sL abs(sL-sLtR) abs sL-sLtR sL sLtR abs(x-sR)+abs(sR-sRtR) abs(x-sR) abs x-sR x sR abs(sR-sRtR) abs sR-sRtR sR sRtR abs(x-sR)+abs(sR-sRtL) abs(x-sR) abs x-sR x sR abs(sR-sRtL) abs sR-sRtL sR sRtL print(chk) print chk sLtL = t[0] t[0] sLtL chk = min(abs(x-sL)+abs(sL-sLtL),abs(x-sL)+abs(sL-sLtR),abs(x-sR)+abs(sR-sRtR),abs(x-sR)+abs(sR-sRtL)) min(abs(x-sL)+abs(sL-sLtL),abs(x-sL)+abs(sL-sLtR),abs(x-sR)+abs(sR-sRtR),abs(x-sR)+abs(sR-sRtL)) chk sLtL = t[sLt-1] t[sLt-1] sLtL x = int(input()) int(input()) x sLt = bisect(t,sL) bisect(t,sL) sLt sRtL = s[0] s[0] sRtL ss = bisect(s,x) bisect(s,x) ss sR = s[ss] s[ss] sR sL = t[-1] t[-1] sL sR = s[0] s[0] sR sL = s[0] s[0] sL sRt = bisect(s,sR) bisect(s,sR) sRt readline = sys.stdin.buffer.readline sys.stdin.buffer.readline readline sR = s[-1] s[-1] sR a,b,q = map(int,readline().split()) map(int,readline().split()) a sL = t[0] t[0] sL q = map(int,readline().split()) map(int,readline().split()) q sLtR = t[sLt] t[sLt] sLtR sR = t[-1] t[-1] sR sRtL = s[sRt-1] s[sRt-1] sRtL readlines = sys.stdin.buffer.readlines sys.stdin.buffer.readlines readlines ss = bisect(t,x) bisect(t,x) ss sL = s[-1] s[-1] sL sR = t[0] t[0] sR sLtR = s[-1] s[-1] sLtR sRt = bisect(t,sR) bisect(t,sR) sRt sL = t[ss-1] t[ss-1] sL b,q = map(int,readline().split()) map(int,readline().split()) b t = [int(readline()) for i in range(b)] [int(readline()) for i in range(b)] t sRtR = t[sRt] t[sRt] sRtR sRtR = s[-1] s[-1] sRtR sLt = bisect(s,sL) bisect(s,sL) sLt sLtR = s[sLt] s[sLt] sLtR sLtL = s[0] s[0] sLtL sL = s[ss-1] s[ss-1] sL sRtR = t[-1] t[-1] sRtR s = [int(readline()) for i in range(a)] [int(readline()) for i in range(a)] s sLtR = t[-1] t[-1] sLtR chk = min(chk,abs(x-sL)+abs(sL-sLtL),abs(x-sL)+abs(sL-sLtR),abs(x-sR)+abs(sR-sRtR),abs(x-sR)+abs(sR-sRtL)) min(chk,abs(x-sL)+abs(sL-sLtL),abs(x-sL)+abs(sL-sLtR),abs(x-sR)+abs(sR-sRtR),abs(x-sR)+abs(sR-sRtL)) chk sRtL = t[sRt-1] t[sRt-1] sRtL sRtL = t[0] t[0] sRtL sRtR = s[sRt] s[sRt] sRtR sLtL = s[sLt-1] s[sLt-1] sLtL read = sys.stdin.buffer.read sys.stdin.buffer.read read sR = t[ss] t[ss] sR
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
from bisect import bisect

a,b,q = map(int,readline().split())
s = [int(readline()) for i in range(a)]
t = [int(readline()) for i in range(b)]

for i in range(q):
  x = int(input())
  ss = bisect(s,x)
  if ss == 0:
    sR = s[0]
    sL = s[0]
  elif ss == len(s):
    sR = s[-1]
    sL = s[-1]
  else:
    sR = s[ss]
    sL = s[ss-1]
    
  sRt = bisect(t,sR)
  sLt = bisect(t,sL)
  if sRt == 0:
    sRtL = t[0]
  else:
    sRtL = t[sRt-1]
  if sLt == len(t):
    sLtR = t[-1]
  else:
    sLtR = t[sLt]
  if sRt == len(t):
    sRtR = t[-1]
  else:
    sRtR = t[sRt]
  if sLt == 0:
    sLtL = t[0]
  else:
    sLtL = t[sLt-1]
  chk = min(abs(x-sL)+abs(sL-sLtL),abs(x-sL)+abs(sL-sLtR),abs(x-sR)+abs(sR-sRtR),abs(x-sR)+abs(sR-sRtL))
  ss = bisect(t,x)
  if ss == 0:
    sR = t[0]
    sL = t[0]
  elif ss == len(t):
    sR = t[-1]
    sL = t[-1]
  else:
    sR = t[ss]
    sL = t[ss-1]
  sRt = bisect(s,sR)
  sLt = bisect(s,sL)
  if sRt == 0:
    sRtL = s[0]
  else:
    sRtL = s[sRt-1]
  if sLt == len(s):
    sLtR = s[-1]
  else:
    sLtR = s[sLt]
  if sRt == len(s):
    sRtR = s[-1]
  else:
    sRtR = s[sRt]
  if sLt == 0:
    sLtL = s[0]
  else:
    sLtL = s[sLt-1]  
  chk = min(chk,abs(x-sL)+abs(sL-sLtL),abs(x-sL)+abs(sL-sLtR),abs(x-sR)+abs(sR-sRtR),abs(x-sR)+abs(sR-sRtL))
  print(chk)