import sys
from bisect import *
input = sys.stdin.buffer.readline

INF = 10 ** 13

A, B, Q = map(int, input().split())
shrines = [-INF] + [int(input()) for _ in range(A)] + [INF]
temples = [-INF] + [int(input()) for _ in range(B)] + [INF]
queries = [int(input()) for _ in range(Q)]

for x in queries:
    s_index = bisect(shrines, x)
    t_index = bisect(temples, x)
    rs = shrines[s_index]
    rt = temples[t_index]
    ls = shrines[s_index - 1]
    lt = temples[t_index - 1]
    ans = INF
    ans = min(ans, max(rs, rt) - x)
    ans = min(ans, x - min(ls, lt))
    ans = min(ans, (rt - ls)*2 - max(rt-x, x-ls))    
    ans = min(ans, (rs - lt)*2 - max(rs-x, x-lt))
    print(ans)
    
      import sys sys from bisect import * input = sys.stdin.buffer.readline input sys.stdin.buffer.readline sys.stdin.buffer sys.stdin sys stdin buffer readline INF = 10 ** 13 INF 10 ** 13 10 13 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 shrines = [-INF] + [int(input()) for _ in range(A)] + [INF] shrines [-INF] + [int(input()) for _ in range(A)] + [INF] [-INF] + [int(input()) for _ in range(A)] [-INF] -INF INF [int(input()) for _ in range(A)] [INF] INF int(input()) for _ in range(B) for _ in range(B) _ range(B) range B for _ in range(B) int(input()) int input() input temples = [-INF] + [int(input()) for _ in range(B)] + [INF] temples [-INF] + [int(input()) for _ in range(B)] + [INF] [-INF] + [int(input()) for _ in range(B)] [-INF] -INF INF [int(input()) for _ in range(B)] [INF] INF int(input()) for _ in range(Q) for _ in range(Q) _ range(Q) range Q for _ in range(Q) int(input()) int input() input queries = [int(input()) for _ in range(Q)] queries [int(input()) for _ in range(Q)] for x in queries:
    s_index = bisect(shrines, x)
    t_index = bisect(temples, x)
    rs = shrines[s_index]
    rt = temples[t_index]
    ls = shrines[s_index - 1]
    lt = temples[t_index - 1]
    ans = INF
    ans = min(ans, max(rs, rt) - x)
    ans = min(ans, x - min(ls, lt))
    ans = min(ans, (rt - ls)*2 - max(rt-x, x-ls))    
    ans = min(ans, (rs - lt)*2 - max(rs-x, x-lt))
    print(ans)
    
      x queries s_index = bisect(shrines, x) s_index bisect(shrines, x) bisect shrines x t_index = bisect(temples, x) t_index bisect(temples, x) bisect temples x rs = shrines[s_index] rs shrines[s_index] shrines s_index rt = temples[t_index] rt temples[t_index] temples t_index ls = shrines[s_index - 1] ls shrines[s_index - 1] shrines s_index - 1 s_index 1 lt = temples[t_index - 1] lt temples[t_index - 1] temples t_index - 1 t_index 1 ans = INF ans INF ans = min(ans, max(rs, rt) - x) ans min(ans, max(rs, rt) - x) min ans max(rs, rt) - x max(rs, rt) max rs rt x ans = min(ans, x - min(ls, lt)) ans min(ans, x - min(ls, lt)) min ans x - min(ls, lt) x min(ls, lt) min ls lt ans = min(ans, (rt - ls)*2 - max(rt-x, x-ls)) ans min(ans, (rt - ls)*2 - max(rt-x, x-ls)) min ans (rt - ls)*2 - max(rt-x, x-ls) (rt - ls)*2 rt - ls rt ls 2 max(rt-x, x-ls) max rt-x rt x x-ls x ls ans = min(ans, (rs - lt)*2 - max(rs-x, x-lt)) ans min(ans, (rs - lt)*2 - max(rs-x, x-lt)) min ans (rs - lt)*2 - max(rs-x, x-lt) (rs - lt)*2 rs - lt rs lt 2 max(rs-x, x-lt) max rs-x rs x x-lt x lt print(ans) print ans shrines = [-INF] + [int(input()) for _ in range(A)] + [INF] [-INF] + [int(input()) for _ in range(A)] + [INF] shrines rt = temples[t_index] temples[t_index] rt lt = temples[t_index - 1] temples[t_index - 1] lt Q = map(int, input().split()) map(int, input().split()) Q B, Q = map(int, input().split()) map(int, input().split()) B rs = shrines[s_index] shrines[s_index] rs t_index = bisect(temples, x) bisect(temples, x) t_index input = sys.stdin.buffer.readline sys.stdin.buffer.readline input INF = 10 ** 13 10 ** 13 INF queries = [int(input()) for _ in range(Q)] [int(input()) for _ in range(Q)] queries s_index = bisect(shrines, x) bisect(shrines, x) s_index ans = INF INF ans ans = min(ans, (rs - lt)*2 - max(rs-x, x-lt)) min(ans, (rs - lt)*2 - max(rs-x, x-lt)) ans temples = [-INF] + [int(input()) for _ in range(B)] + [INF] [-INF] + [int(input()) for _ in range(B)] + [INF] temples ans = min(ans, x - min(ls, lt)) min(ans, x - min(ls, lt)) ans A, B, Q = map(int, input().split()) map(int, input().split()) A ls = shrines[s_index - 1] shrines[s_index - 1] ls ans = min(ans, (rt - ls)*2 - max(rt-x, x-ls)) min(ans, (rt - ls)*2 - max(rt-x, x-ls)) ans ans = min(ans, max(rs, rt) - x) min(ans, max(rs, rt) - x) ans
import sys
from bisect import *
input = sys.stdin.buffer.readline

INF = 10 ** 13

A, B, Q = map(int, input().split())
shrines = [-INF] + [int(input()) for _ in range(A)] + [INF]
temples = [-INF] + [int(input()) for _ in range(B)] + [INF]
queries = [int(input()) for _ in range(Q)]

for x in queries:
    s_index = bisect(shrines, x)
    t_index = bisect(temples, x)
    rs = shrines[s_index]
    rt = temples[t_index]
    ls = shrines[s_index - 1]
    lt = temples[t_index - 1]
    ans = INF
    ans = min(ans, max(rs, rt) - x)
    ans = min(ans, x - min(ls, lt))
    ans = min(ans, (rt - ls)*2 - max(rt-x, x-ls))    
    ans = min(ans, (rs - lt)*2 - max(rs-x, x-lt))
    print(ans)
    
     
