import sys
input = lambda : sys.stdin.readline().rstrip()
sys.setrecursionlimit(max(1000, 10**9))
write = lambda x: sys.stdout.write(x+"\n")


a,b,q = list(map(int, input().split()))
s = [int(input()) for _ in range(a)]
t = [int(input()) for _ in range(b)]
from bisect import bisect_left as bl
ls = [None]*a
lt = [None]*b
for i in range(a):
    ind = bl(t, s[i])
    v = float("inf")
    if ind<b:
        v = min(v, abs(t[ind]-s[i]))
    if ind>0:
        v = min(v, abs(t[ind-1]-s[i]))
    ls[i] = v
for i in range(b):
    ind = bl(s, t[i])
    v = float("inf")
    if ind<a:
        v = min(v, abs(s[ind]-t[i]))
    if ind>0:
        v = min(v, abs(s[ind-1]-t[i]))
    lt[i] = v
ans = [None]*q
for i in range(q):
    x = int(input())
    v = float("inf")
    ind = bl(s, x)
    if ind<a:
        v = min(v, abs(s[ind]-x)+ls[ind])
    if ind>0:
        v = min(v, abs(s[ind-1]-x)+ls[ind-1])
    ind = bl(t, x)
    if ind<b:
        v = min(v, abs(t[ind]-x)+lt[ind])
    if ind>0:
        v = min(v, abs(t[ind-1]-x)+lt[ind-1])
    ans[i] = v
write("\n".join(map(str, ans))) import sys sys input = lambda : sys.stdin.readline().rstrip() input lambda : sys.stdin.readline().rstrip() sys.stdin.readline().rstrip() sys.stdin.readline().rstrip sys.stdin.readline() sys.stdin.readline sys.stdin sys stdin readline rstrip sys.setrecursionlimit(max(1000, 10**9)) sys.setrecursionlimit sys setrecursionlimit max(1000, 10**9) max 1000 10**9 10 9 write = lambda x: sys.stdout.write(x+"\n") write lambda x: sys.stdout.write(x+"\n") sys.stdout.write(x+"\n") sys.stdout.write sys.stdout sys stdout write x+"\n" x "\n" x a,b,q = list(map(int, input().split())) a list(map(int, input().split())) list 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 s = [int(input()) for _ in range(a)] s [int(input()) for _ in range(a)] int(input()) for _ in range(b) for _ in range(b) _ range(b) range b for _ in range(b) int(input()) int input() input t = [int(input()) for _ in range(b)] t [int(input()) for _ in range(b)] from bisect import bisect_left as bl ls = [None]*a ls [None]*a [None] None a lt = [None]*b lt [None]*b [None] None b for i in range(a):
    ind = bl(t, s[i])
    v = float("inf")
    if ind<b:
        v = min(v, abs(t[ind]-s[i]))
    if ind>0:
        v = min(v, abs(t[ind-1]-s[i]))
    ls[i] = v i range(a) range a ind = bl(t, s[i]) ind bl(t, s[i]) bl t s[i] s i v = float("inf") v float("inf") float "inf" if ind<b:
        v = min(v, abs(t[ind]-s[i]))
     ind<b ind b v = min(v, abs(t[ind]-s[i])) v min(v, abs(t[ind]-s[i])) min v abs(t[ind]-s[i]) abs t[ind]-s[i] t[ind] t ind s[i] s i if ind>0:
        v = min(v, abs(t[ind-1]-s[i]))
     ind>0 ind 0 v = min(v, abs(t[ind-1]-s[i])) v min(v, abs(t[ind-1]-s[i])) min v abs(t[ind-1]-s[i]) abs t[ind-1]-s[i] t[ind-1] t ind-1 ind 1 s[i] s i ls[i] = v ls[i] ls i v for i in range(b):
    ind = bl(s, t[i])
    v = float("inf")
    if ind<a:
        v = min(v, abs(s[ind]-t[i]))
    if ind>0:
        v = min(v, abs(s[ind-1]-t[i]))
    lt[i] = v i range(b) range b ind = bl(s, t[i]) ind bl(s, t[i]) bl s t[i] t i v = float("inf") v float("inf") float "inf" if ind<a:
        v = min(v, abs(s[ind]-t[i]))
     ind<a ind a v = min(v, abs(s[ind]-t[i])) v min(v, abs(s[ind]-t[i])) min v abs(s[ind]-t[i]) abs s[ind]-t[i] s[ind] s ind t[i] t i if ind>0:
        v = min(v, abs(s[ind-1]-t[i]))
     ind>0 ind 0 v = min(v, abs(s[ind-1]-t[i])) v min(v, abs(s[ind-1]-t[i])) min v abs(s[ind-1]-t[i]) abs s[ind-1]-t[i] s[ind-1] s ind-1 ind 1 t[i] t i lt[i] = v lt[i] lt i v ans = [None]*q ans [None]*q [None] None q for i in range(q):
    x = int(input())
    v = float("inf")
    ind = bl(s, x)
    if ind<a:
        v = min(v, abs(s[ind]-x)+ls[ind])
    if ind>0:
        v = min(v, abs(s[ind-1]-x)+ls[ind-1])
    ind = bl(t, x)
    if ind<b:
        v = min(v, abs(t[ind]-x)+lt[ind])
    if ind>0:
        v = min(v, abs(t[ind-1]-x)+lt[ind-1])
    ans[i] = v i range(q) range q x = int(input()) x int(input()) int input() input v = float("inf") v float("inf") float "inf" ind = bl(s, x) ind bl(s, x) bl s x if ind<a:
        v = min(v, abs(s[ind]-x)+ls[ind])
     ind<a ind a v = min(v, abs(s[ind]-x)+ls[ind]) v min(v, abs(s[ind]-x)+ls[ind]) min v abs(s[ind]-x)+ls[ind] abs(s[ind]-x) abs s[ind]-x s[ind] s ind x ls[ind] ls ind if ind>0:
        v = min(v, abs(s[ind-1]-x)+ls[ind-1])
     ind>0 ind 0 v = min(v, abs(s[ind-1]-x)+ls[ind-1]) v min(v, abs(s[ind-1]-x)+ls[ind-1]) min v abs(s[ind-1]-x)+ls[ind-1] abs(s[ind-1]-x) abs s[ind-1]-x s[ind-1] s ind-1 ind 1 x ls[ind-1] ls ind-1 ind 1 ind = bl(t, x) ind bl(t, x) bl t x if ind<b:
        v = min(v, abs(t[ind]-x)+lt[ind])
     ind<b ind b v = min(v, abs(t[ind]-x)+lt[ind]) v min(v, abs(t[ind]-x)+lt[ind]) min v abs(t[ind]-x)+lt[ind] abs(t[ind]-x) abs t[ind]-x t[ind] t ind x lt[ind] lt ind if ind>0:
        v = min(v, abs(t[ind-1]-x)+lt[ind-1])
     ind>0 ind 0 v = min(v, abs(t[ind-1]-x)+lt[ind-1]) v min(v, abs(t[ind-1]-x)+lt[ind-1]) min v abs(t[ind-1]-x)+lt[ind-1] abs(t[ind-1]-x) abs t[ind-1]-x t[ind-1] t ind-1 ind 1 x lt[ind-1] lt ind-1 ind 1 ans[i] = v ans[i] ans i v write("\n".join(map(str, ans))) write "\n".join(map(str, ans)) "\n".join "\n" join map(str, ans) map str ans v = min(v, abs(s[ind]-x)+ls[ind]) min(v, abs(s[ind]-x)+ls[ind]) v v = min(v, abs(s[ind-1]-t[i])) min(v, abs(s[ind-1]-t[i])) v ind = bl(t, x) bl(t, x) ind q = list(map(int, input().split())) list(map(int, input().split())) q s = [int(input()) for _ in range(a)] [int(input()) for _ in range(a)] s ind = bl(s, t[i]) bl(s, t[i]) ind v = min(v, abs(t[ind-1]-s[i])) min(v, abs(t[ind-1]-s[i])) v v = min(v, abs(t[ind]-x)+lt[ind]) min(v, abs(t[ind]-x)+lt[ind]) v b,q = list(map(int, input().split())) list(map(int, input().split())) b v = float("inf") float("inf") v write = lambda x: sys.stdout.write(x+"\n") lambda x: sys.stdout.write(x+"\n") write v = min(v, abs(s[ind-1]-x)+ls[ind-1]) min(v, abs(s[ind-1]-x)+ls[ind-1]) v input = lambda : sys.stdin.readline().rstrip() lambda : sys.stdin.readline().rstrip() input lt = [None]*b [None]*b lt ls = [None]*a [None]*a ls v = min(v, abs(t[ind]-s[i])) min(v, abs(t[ind]-s[i])) v ind = bl(t, s[i]) bl(t, s[i]) ind a,b,q = list(map(int, input().split())) list(map(int, input().split())) a v = min(v, abs(s[ind]-t[i])) min(v, abs(s[ind]-t[i])) v ind = bl(s, x) bl(s, x) ind v = float("inf") float("inf") v v = float("inf") float("inf") v t = [int(input()) for _ in range(b)] [int(input()) for _ in range(b)] t ans = [None]*q [None]*q ans x = int(input()) int(input()) x v = min(v, abs(t[ind-1]-x)+lt[ind-1]) min(v, abs(t[ind-1]-x)+lt[ind-1]) v
import sys
input = lambda : sys.stdin.readline().rstrip()
sys.setrecursionlimit(max(1000, 10**9))
write = lambda x: sys.stdout.write(x+"\n")


a,b,q = list(map(int, input().split()))
s = [int(input()) for _ in range(a)]
t = [int(input()) for _ in range(b)]
from bisect import bisect_left as bl
ls = [None]*a
lt = [None]*b
for i in range(a):
    ind = bl(t, s[i])
    v = float("inf")
    if ind<b:
        v = min(v, abs(t[ind]-s[i]))
    if ind>0:
        v = min(v, abs(t[ind-1]-s[i]))
    ls[i] = v
for i in range(b):
    ind = bl(s, t[i])
    v = float("inf")
    if ind<a:
        v = min(v, abs(s[ind]-t[i]))
    if ind>0:
        v = min(v, abs(s[ind-1]-t[i]))
    lt[i] = v
ans = [None]*q
for i in range(q):
    x = int(input())
    v = float("inf")
    ind = bl(s, x)
    if ind<a:
        v = min(v, abs(s[ind]-x)+ls[ind])
    if ind>0:
        v = min(v, abs(s[ind-1]-x)+ls[ind-1])
    ind = bl(t, x)
    if ind<b:
        v = min(v, abs(t[ind]-x)+lt[ind])
    if ind>0:
        v = min(v, abs(t[ind-1]-x)+lt[ind-1])
    ans[i] = v
write("\n".join(map(str, ans)))