from bisect import bisect_left,bisect
a,b,q = map(int,input().split())
jin = [-10**16]
for i in range(a):
    jin.append(int(input()))
jin.append(10**16)
tera = [-10**20]
for i in range(b):
    tera.append(int(input()))
tera.append(10**20)
for i in range(q):
    x = int(input())
    j = bisect(jin,x)
    t = bisect(tera,x)
    j1 = jin[j]
    j2 = jin[j-1]
    t1 = tera[t]
    t2 = tera[t-1]
    ans = min(abs(x-j1)+abs(j1-t1),abs(x-j1)+abs(j1-t2),abs(x-j2)+abs(j2-t1),abs(x-j2)+abs(j2-t2))
    ans = min(ans,abs(x-t1)+abs(t1-j1),abs(x-t1)+abs(t1-j2),abs(x-t2)+abs(t2-j1),abs(x-t2)+abs(t2-j2))
    print(ans) from bisect import bisect_left,bisect a,b,q = map(int,input().split()) a map(int,input().split()) map int input().split() ().split () input split b q jin = [-10**16] jin [-10**16] -10**16 -10 16 for i in range(a):
    jin.append(int(input())) i range(a) range a jin.append(int(input())) jin.append jin append int(input()) int input() input jin.append(10**16) jin.append jin append 10**16 10 16 tera = [-10**20] tera [-10**20] -10**20 -10 20 for i in range(b):
    tera.append(int(input())) i range(b) range b tera.append(int(input())) tera.append tera append int(input()) int input() input tera.append(10**20) tera.append tera append 10**20 10 20 for i in range(q):
    x = int(input())
    j = bisect(jin,x)
    t = bisect(tera,x)
    j1 = jin[j]
    j2 = jin[j-1]
    t1 = tera[t]
    t2 = tera[t-1]
    ans = min(abs(x-j1)+abs(j1-t1),abs(x-j1)+abs(j1-t2),abs(x-j2)+abs(j2-t1),abs(x-j2)+abs(j2-t2))
    ans = min(ans,abs(x-t1)+abs(t1-j1),abs(x-t1)+abs(t1-j2),abs(x-t2)+abs(t2-j1),abs(x-t2)+abs(t2-j2))
    print(ans) i range(q) range q x = int(input()) x int(input()) int input() input j = bisect(jin,x) j bisect(jin,x) bisect jin x t = bisect(tera,x) t bisect(tera,x) bisect tera x j1 = jin[j] j1 jin[j] jin j j2 = jin[j-1] j2 jin[j-1] jin j-1 j 1 t1 = tera[t] t1 tera[t] tera t t2 = tera[t-1] t2 tera[t-1] tera t-1 t 1 ans = min(abs(x-j1)+abs(j1-t1),abs(x-j1)+abs(j1-t2),abs(x-j2)+abs(j2-t1),abs(x-j2)+abs(j2-t2)) ans min(abs(x-j1)+abs(j1-t1),abs(x-j1)+abs(j1-t2),abs(x-j2)+abs(j2-t1),abs(x-j2)+abs(j2-t2)) min abs(x-j1)+abs(j1-t1) abs(x-j1) abs x-j1 x j1 abs(j1-t1) abs j1-t1 j1 t1 abs(x-j1)+abs(j1-t2) abs(x-j1) abs x-j1 x j1 abs(j1-t2) abs j1-t2 j1 t2 abs(x-j2)+abs(j2-t1) abs(x-j2) abs x-j2 x j2 abs(j2-t1) abs j2-t1 j2 t1 abs(x-j2)+abs(j2-t2) abs(x-j2) abs x-j2 x j2 abs(j2-t2) abs j2-t2 j2 t2 ans = min(ans,abs(x-t1)+abs(t1-j1),abs(x-t1)+abs(t1-j2),abs(x-t2)+abs(t2-j1),abs(x-t2)+abs(t2-j2)) ans min(ans,abs(x-t1)+abs(t1-j1),abs(x-t1)+abs(t1-j2),abs(x-t2)+abs(t2-j1),abs(x-t2)+abs(t2-j2)) min ans abs(x-t1)+abs(t1-j1) abs(x-t1) abs x-t1 x t1 abs(t1-j1) abs t1-j1 t1 j1 abs(x-t1)+abs(t1-j2) abs(x-t1) abs x-t1 x t1 abs(t1-j2) abs t1-j2 t1 j2 abs(x-t2)+abs(t2-j1) abs(x-t2) abs x-t2 x t2 abs(t2-j1) abs t2-j1 t2 j1 abs(x-t2)+abs(t2-j2) abs(x-t2) abs x-t2 x t2 abs(t2-j2) abs t2-j2 t2 j2 print(ans) print ans j = bisect(jin,x) bisect(jin,x) j tera = [-10**20] [-10**20] tera x = int(input()) int(input()) x ans = min(ans,abs(x-t1)+abs(t1-j1),abs(x-t1)+abs(t1-j2),abs(x-t2)+abs(t2-j1),abs(x-t2)+abs(t2-j2)) min(ans,abs(x-t1)+abs(t1-j1),abs(x-t1)+abs(t1-j2),abs(x-t2)+abs(t2-j1),abs(x-t2)+abs(t2-j2)) ans b,q = map(int,input().split()) map(int,input().split()) b t = bisect(tera,x) bisect(tera,x) t j2 = jin[j-1] jin[j-1] j2 q = map(int,input().split()) map(int,input().split()) q t2 = tera[t-1] tera[t-1] t2 jin = [-10**16] [-10**16] jin t1 = tera[t] tera[t] t1 ans = min(abs(x-j1)+abs(j1-t1),abs(x-j1)+abs(j1-t2),abs(x-j2)+abs(j2-t1),abs(x-j2)+abs(j2-t2)) min(abs(x-j1)+abs(j1-t1),abs(x-j1)+abs(j1-t2),abs(x-j2)+abs(j2-t1),abs(x-j2)+abs(j2-t2)) ans a,b,q = map(int,input().split()) map(int,input().split()) a j1 = jin[j] jin[j] j1
from bisect import bisect_left,bisect
a,b,q = map(int,input().split())
jin = [-10**16]
for i in range(a):
    jin.append(int(input()))
jin.append(10**16)
tera = [-10**20]
for i in range(b):
    tera.append(int(input()))
tera.append(10**20)
for i in range(q):
    x = int(input())
    j = bisect(jin,x)
    t = bisect(tera,x)
    j1 = jin[j]
    j2 = jin[j-1]
    t1 = tera[t]
    t2 = tera[t-1]
    ans = min(abs(x-j1)+abs(j1-t1),abs(x-j1)+abs(j1-t2),abs(x-j2)+abs(j2-t1),abs(x-j2)+abs(j2-t2))
    ans = min(ans,abs(x-t1)+abs(t1-j1),abs(x-t1)+abs(t1-j2),abs(x-t2)+abs(t2-j1),abs(x-t2)+abs(t2-j2))
    print(ans)