#!usr/bin/env python3
from collections import defaultdict, deque
from heapq import heappush, heappop
from itertools import permutations, accumulate
import sys
import math
import bisect
def LI(): return [int(x) for x in sys.stdin.buffer.readline().split()]
def I(): return int(sys.stdin.buffer.readline())
def LS():return [list(x) for x in sys.stdin.readline().split()]
def S():
    res = list(sys.stdin.readline())
    if res[-1] == "\n":
        return res[:-1]
    return res
def IR(n):
    return [I() for i in range(n)]
def LIR(n):
    return [LI() for i in range(n)]
def SR(n):
    return [S() for i in range(n)]
def LSR(n):
    return [LS() for i in range(n)]

sys.setrecursionlimit(1000000)
mod = 1000000007

def solve():
    a,b,q = LI()
    s = IR(a)
    t = IR(b)
    X = IR(q)
    for x in X:
        i = bisect.bisect_right(s,x)-1
        j = bisect.bisect_right(t,x)-1
        res = float("inf")
        if i >= 0:
            si = s[i]
            if j >= 0:
                tj = t[j]
                res = x-min(si,tj)
            if j+1 < b:
                tj = t[j+1]
                m = min(abs(si-x),abs(tj-x))+abs(tj-si)
                if m < res:
                    res = m
        if i+1 < a:
            si = s[i+1]
            if j >= 0:
                tj = t[j]
                m = min(abs(si-x),abs(tj-x))+abs(si-tj)
                if m < res:
                    res = m
            if j+1 < b:
                tj = t[j+1]
                res = min(res,max(si,tj)-x)
        print(res)
    return

#Solve
if __name__ == "__main__":
    solve() from collections import defaultdict, deque from heapq import heappush, heappop from itertools import permutations, accumulate import sys sys import math math import bisect bisect int(x) for x in sys.stdin.buffer.readline().split() for x in sys.stdin.buffer.readline().split() x sys.stdin.buffer.readline().split() sys.stdin.buffer.readline().split sys.stdin.buffer.readline() sys.stdin.buffer.readline sys.stdin.buffer sys.stdin sys stdin buffer readline split for x in sys.stdin.buffer.readline().split() int(x) int x def LI(): return [int(x) for x in sys.stdin.buffer.readline().split()] LI def I(): return int(sys.stdin.buffer.readline()) I list(x) for x in sys.stdin.readline().split() for x in sys.stdin.readline().split() x sys.stdin.readline().split() sys.stdin.readline().split sys.stdin.readline() sys.stdin.readline sys.stdin sys stdin readline split for x in sys.stdin.readline().split() list(x) list x def LS():return [list(x) for x in sys.stdin.readline().split()] LS def S():
    res = list(sys.stdin.readline())
    if res[-1] == "\n":
        return res[:-1]
    return res S res = list(sys.stdin.readline()) res list(sys.stdin.readline()) list sys.stdin.readline() sys.stdin.readline sys.stdin sys stdin readline if res[-1] == "\n":
        return res[:-1]
     res[-1] == "\n" res[-1] res -1 "\n" return res[:-1] res[:-1] res :-1 -1 return res res def IR(n):
    return [I() for i in range(n)] IR I() for i in range(n) for i in range(n) i range(n) range n for i in range(n) I() I return [I() for i in range(n)] [I() for i in range(n)] n n def LIR(n):
    return [LI() for i in range(n)] LIR LI() for i in range(n) for i in range(n) i range(n) range n for i in range(n) LI() LI return [LI() for i in range(n)] [LI() for i in range(n)] n n def SR(n):
    return [S() for i in range(n)] SR S() for i in range(n) for i in range(n) i range(n) range n for i in range(n) S() S return [S() for i in range(n)] [S() for i in range(n)] n n def LSR(n):
    return [LS() for i in range(n)] LSR LS() for i in range(n) for i in range(n) i range(n) range n for i in range(n) LS() LS return [LS() for i in range(n)] [LS() for i in range(n)] n n sys.setrecursionlimit(1000000) sys.setrecursionlimit sys setrecursionlimit 1000000 mod = 1000000007 mod 1000000007 def solve():
    a,b,q = LI()
    s = IR(a)
    t = IR(b)
    X = IR(q)
    for x in X:
        i = bisect.bisect_right(s,x)-1
        j = bisect.bisect_right(t,x)-1
        res = float("inf")
        if i >= 0:
            si = s[i]
            if j >= 0:
                tj = t[j]
                res = x-min(si,tj)
            if j+1 < b:
                tj = t[j+1]
                m = min(abs(si-x),abs(tj-x))+abs(tj-si)
                if m < res:
                    res = m
        if i+1 < a:
            si = s[i+1]
            if j >= 0:
                tj = t[j]
                m = min(abs(si-x),abs(tj-x))+abs(si-tj)
                if m < res:
                    res = m
            if j+1 < b:
                tj = t[j+1]
                res = min(res,max(si,tj)-x)
        print(res)
    return

#Solve solve a,b,q = LI() a LI() LI b q s = IR(a) s IR(a) IR a t = IR(b) t IR(b) IR b X = IR(q) X IR(q) IR q for x in X:
        i = bisect.bisect_right(s,x)-1
        j = bisect.bisect_right(t,x)-1
        res = float("inf")
        if i >= 0:
            si = s[i]
            if j >= 0:
                tj = t[j]
                res = x-min(si,tj)
            if j+1 < b:
                tj = t[j+1]
                m = min(abs(si-x),abs(tj-x))+abs(tj-si)
                if m < res:
                    res = m
        if i+1 < a:
            si = s[i+1]
            if j >= 0:
                tj = t[j]
                m = min(abs(si-x),abs(tj-x))+abs(si-tj)
                if m < res:
                    res = m
            if j+1 < b:
                tj = t[j+1]
                res = min(res,max(si,tj)-x)
        print(res)
     x X i = bisect.bisect_right(s,x)-1 i bisect.bisect_right(s,x)-1 bisect.bisect_right(s,x) bisect.bisect_right bisect bisect_right s x 1 j = bisect.bisect_right(t,x)-1 j bisect.bisect_right(t,x)-1 bisect.bisect_right(t,x) bisect.bisect_right bisect bisect_right t x 1 res = float("inf") res float("inf") float "inf" if i >= 0:
            si = s[i]
            if j >= 0:
                tj = t[j]
                res = x-min(si,tj)
            if j+1 < b:
                tj = t[j+1]
                m = min(abs(si-x),abs(tj-x))+abs(tj-si)
                if m < res:
                    res = m
         i >= 0 i 0 si = s[i] si s[i] s i if j >= 0:
                tj = t[j]
                res = x-min(si,tj)
             j >= 0 j 0 tj = t[j] tj t[j] t j res = x-min(si,tj) res x-min(si,tj) x min(si,tj) min si tj if j+1 < b:
                tj = t[j+1]
                m = min(abs(si-x),abs(tj-x))+abs(tj-si)
                if m < res:
                    res = m
         j+1 < b j+1 j 1 b tj = t[j+1] tj t[j+1] t j+1 j 1 m = min(abs(si-x),abs(tj-x))+abs(tj-si) m min(abs(si-x),abs(tj-x))+abs(tj-si) min(abs(si-x),abs(tj-x)) min abs(si-x) abs si-x si x abs(tj-x) abs tj-x tj x abs(tj-si) abs tj-si tj si if m < res:
                    res = m
         m < res m res res = m res m if i+1 < a:
            si = s[i+1]
            if j >= 0:
                tj = t[j]
                m = min(abs(si-x),abs(tj-x))+abs(si-tj)
                if m < res:
                    res = m
            if j+1 < b:
                tj = t[j+1]
                res = min(res,max(si,tj)-x)
         i+1 < a i+1 i 1 a si = s[i+1] si s[i+1] s i+1 i 1 if j >= 0:
                tj = t[j]
                m = min(abs(si-x),abs(tj-x))+abs(si-tj)
                if m < res:
                    res = m
             j >= 0 j 0 tj = t[j] tj t[j] t j m = min(abs(si-x),abs(tj-x))+abs(si-tj) m min(abs(si-x),abs(tj-x))+abs(si-tj) min(abs(si-x),abs(tj-x)) min abs(si-x) abs si-x si x abs(tj-x) abs tj-x tj x abs(si-tj) abs si-tj si tj if m < res:
                    res = m
             m < res m res res = m res m if j+1 < b:
                tj = t[j+1]
                res = min(res,max(si,tj)-x)
         j+1 < b j+1 j 1 b tj = t[j+1] tj t[j+1] t j+1 j 1 res = min(res,max(si,tj)-x) res min(res,max(si,tj)-x) min res max(si,tj)-x max(si,tj) max si tj x print(res) print res return if __name__ == "__main__":
    solve() __name__ == "__main__" __name__ "__main__" solve() solve def SR(n):
    return [S() for i in range(n)] def SR(n):
    return [S() for i in range(n)] SR def solve():
    a,b,q = LI()
    s = IR(a)
    t = IR(b)
    X = IR(q)
    for x in X:
        i = bisect.bisect_right(s,x)-1
        j = bisect.bisect_right(t,x)-1
        res = float("inf")
        if i >= 0:
            si = s[i]
            if j >= 0:
                tj = t[j]
                res = x-min(si,tj)
            if j+1 < b:
                tj = t[j+1]
                m = min(abs(si-x),abs(tj-x))+abs(tj-si)
                if m < res:
                    res = m
        if i+1 < a:
            si = s[i+1]
            if j >= 0:
                tj = t[j]
                m = min(abs(si-x),abs(tj-x))+abs(si-tj)
                if m < res:
                    res = m
            if j+1 < b:
                tj = t[j+1]
                res = min(res,max(si,tj)-x)
        print(res)
    return

#Solve def solve():
    a,b,q = LI()
    s = IR(a)
    t = IR(b)
    X = IR(q)
    for x in X:
        i = bisect.bisect_right(s,x)-1
        j = bisect.bisect_right(t,x)-1
        res = float("inf")
        if i >= 0:
            si = s[i]
            if j >= 0:
                tj = t[j]
                res = x-min(si,tj)
            if j+1 < b:
                tj = t[j+1]
                m = min(abs(si-x),abs(tj-x))+abs(tj-si)
                if m < res:
                    res = m
        if i+1 < a:
            si = s[i+1]
            if j >= 0:
                tj = t[j]
                m = min(abs(si-x),abs(tj-x))+abs(si-tj)
                if m < res:
                    res = m
            if j+1 < b:
                tj = t[j+1]
                res = min(res,max(si,tj)-x)
        print(res)
    return

#Solve solve def LIR(n):
    return [LI() for i in range(n)] def LIR(n):
    return [LI() for i in range(n)] LIR def LSR(n):
    return [LS() for i in range(n)] def LSR(n):
    return [LS() for i in range(n)] LSR def I(): return int(sys.stdin.buffer.readline()) def I(): return int(sys.stdin.buffer.readline()) I def LI(): return [int(x) for x in sys.stdin.buffer.readline().split()] def LI(): return [int(x) for x in sys.stdin.buffer.readline().split()] LI def IR(n):
    return [I() for i in range(n)] def IR(n):
    return [I() for i in range(n)] IR def LS():return [list(x) for x in sys.stdin.readline().split()] def LS():return [list(x) for x in sys.stdin.readline().split()] LS mod = 1000000007 1000000007 mod def S():
    res = list(sys.stdin.readline())
    if res[-1] == "\n":
        return res[:-1]
    return res def S():
    res = list(sys.stdin.readline())
    if res[-1] == "\n":
        return res[:-1]
    return res S
#!usr/bin/env python3
from collections import defaultdict, deque
from heapq import heappush, heappop
from itertools import permutations, accumulate
import sys
import math
import bisect
def LI(): return [int(x) for x in sys.stdin.buffer.readline().split()]
def I(): return int(sys.stdin.buffer.readline())
def LS():return [list(x) for x in sys.stdin.readline().split()]
def S():
    res = list(sys.stdin.readline())
    if res[-1] == "\n":
        return res[:-1]
    return res
def IR(n):
    return [I() for i in range(n)]
def LIR(n):
    return [LI() for i in range(n)]
def SR(n):
    return [S() for i in range(n)]
def LSR(n):
    return [LS() for i in range(n)]

sys.setrecursionlimit(1000000)
mod = 1000000007

def solve():
    a,b,q = LI()
    s = IR(a)
    t = IR(b)
    X = IR(q)
    for x in X:
        i = bisect.bisect_right(s,x)-1
        j = bisect.bisect_right(t,x)-1
        res = float("inf")
        if i >= 0:
            si = s[i]
            if j >= 0:
                tj = t[j]
                res = x-min(si,tj)
            if j+1 < b:
                tj = t[j+1]
                m = min(abs(si-x),abs(tj-x))+abs(tj-si)
                if m < res:
                    res = m
        if i+1 < a:
            si = s[i+1]
            if j >= 0:
                tj = t[j]
                m = min(abs(si-x),abs(tj-x))+abs(si-tj)
                if m < res:
                    res = m
            if j+1 < b:
                tj = t[j+1]
                res = min(res,max(si,tj)-x)
        print(res)
    return

#Solve
if __name__ == "__main__":
    solve()
