findl = ->rxs{->q{rxs.bsearch{|x| x <= q}}}
findr = ->xs{->q{xs.bsearch{|x| x >= q}}}

a, b, q = gets.split.map(&:to_i)
ss = a.times.map{gets.to_i}
ts = b.times.map{gets.to_i}
fsl = findl[ss.reverse]
fsr = findr[ss]
ftl = findl[ts.reverse]
ftr = findr[ts]

q.times{
    x = gets.to_i
    sl = fsl[x]&.-(x)&.abs
    sr = fsr[x]&.-(x)&.abs
    tl = ftl[x]&.-(x)&.abs
    tr = ftr[x]&.-(x)&.abs
    p [sl && tl && [sl, tl].max, sl && tr && (sl + tr + [sl, tr].min), sr && tl && (sr + tl + [sr, tl].min), sr && tr && [sr, tr].max].compact.min
}