#!/usr/bin/python3
import bisect
# from collections import Counter, deque, OrderedDict, defaultdict
# from copy import copy, deepcopy # pythonのみ．copyは1次元，deepcopyは多次元．
# from functools import reduce
# from heapq import heapify, heappop, heappush
# from itertools import accumulate, permutations, combinations, combinations_with_replacement, groupby, product
# import math
# import numpy as np  # Pythonのみ！
# from operator import xor
# import re
# from scipy.sparse.csgraph import connected_components  # Pythonのみ！
# ↑cf.  https://note.nkmk.me/python-scipy-connected-components/
# from scipy.sparse import csr_matrix
# import statistics # Pythonのみ
# import string
import unittest
from io import StringIO
import sys
sys.setrecursionlimit(10 ** 5 + 10)


def input(): return sys.stdin.readline().strip()


def resolve():
    A, B, Q = map(int, input().split())
    INF = 10**20
    s = [-INF]+[int(input()) for _ in range(A)]+[INF]
    t = [-INF]+[int(input()) for _ in range(B)]+[INF]

    for i in range(Q):
        x=int(input())
        saind = bisect.bisect_left(s,x)
        sa = s[saind-1]
        sb = s[saind]
        taind = bisect.bisect_left(t,x)
        ta = t[taind-1]
        tb = t[taind]

        res = 10**20

        for ss in (sa, sb):
            for tt in (ta, tb):
                res = min(res, abs(x-ss)+abs(ss-tt))
        
        for tt in (ta, tb):
            for ss in (sa, sb):
                res = min(res, abs(x-tt)+abs(tt-ss))


        print(res)


resolve() import bisect bisect import unittest unittest from io import StringIO import sys sys sys.setrecursionlimit(10 ** 5 + 10) sys.setrecursionlimit sys setrecursionlimit 10 ** 5 + 10 10 ** 5 10 5 10 def input(): return sys.stdin.readline().strip() input def resolve():
    A, B, Q = map(int, input().split())
    INF = 10**20
    s = [-INF]+[int(input()) for _ in range(A)]+[INF]
    t = [-INF]+[int(input()) for _ in range(B)]+[INF]

    for i in range(Q):
        x=int(input())
        saind = bisect.bisect_left(s,x)
        sa = s[saind-1]
        sb = s[saind]
        taind = bisect.bisect_left(t,x)
        ta = t[taind-1]
        tb = t[taind]

        res = 10**20

        for ss in (sa, sb):
            for tt in (ta, tb):
                res = min(res, abs(x-ss)+abs(ss-tt))
        
        for tt in (ta, tb):
            for ss in (sa, sb):
                res = min(res, abs(x-tt)+abs(tt-ss))


        print(res) resolve A, B, Q = map(int, input().split()) A map(int, input().split()) map int input().split() ().split () input split B Q INF = 10**20 INF 10**20 10 20 int(input()) for _ in range(A) for _ in range(A) _ range(A) range A for _ in range(A) int(input()) int input() input s = [-INF]+[int(input()) for _ in range(A)]+[INF] s [-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 t = [-INF]+[int(input()) for _ in range(B)]+[INF] t [-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 for i in range(Q):
        x=int(input())
        saind = bisect.bisect_left(s,x)
        sa = s[saind-1]
        sb = s[saind]
        taind = bisect.bisect_left(t,x)
        ta = t[taind-1]
        tb = t[taind]

        res = 10**20

        for ss in (sa, sb):
            for tt in (ta, tb):
                res = min(res, abs(x-ss)+abs(ss-tt))
        
        for tt in (ta, tb):
            for ss in (sa, sb):
                res = min(res, abs(x-tt)+abs(tt-ss))


        print(res) i range(Q) range Q x=int(input()) x int(input()) int input() input saind = bisect.bisect_left(s,x) saind bisect.bisect_left(s,x) bisect.bisect_left bisect bisect_left s x sa = s[saind-1] sa s[saind-1] s saind-1 saind 1 sb = s[saind] sb s[saind] s saind taind = bisect.bisect_left(t,x) taind bisect.bisect_left(t,x) bisect.bisect_left bisect bisect_left t x ta = t[taind-1] ta t[taind-1] t taind-1 taind 1 tb = t[taind] tb t[taind] t taind res = 10**20 res 10**20 10 20 for ss in (sa, sb):
            for tt in (ta, tb):
                res = min(res, abs(x-ss)+abs(ss-tt))
        
         ss (sa, sb) sa sb for tt in (ta, tb):
                res = min(res, abs(x-ss)+abs(ss-tt))
        
         tt (ta, tb) ta tb res = min(res, abs(x-ss)+abs(ss-tt)) res min(res, abs(x-ss)+abs(ss-tt)) min res abs(x-ss)+abs(ss-tt) abs(x-ss) abs x-ss x ss abs(ss-tt) abs ss-tt ss tt for tt in (ta, tb):
            for ss in (sa, sb):
                res = min(res, abs(x-tt)+abs(tt-ss))


         tt (ta, tb) ta tb for ss in (sa, sb):
                res = min(res, abs(x-tt)+abs(tt-ss))


         ss (sa, sb) sa sb res = min(res, abs(x-tt)+abs(tt-ss)) res min(res, abs(x-tt)+abs(tt-ss)) min res abs(x-tt)+abs(tt-ss) abs(x-tt) abs x-tt x tt abs(tt-ss) abs tt-ss tt ss print(res) print res resolve() resolve def resolve():
    A, B, Q = map(int, input().split())
    INF = 10**20
    s = [-INF]+[int(input()) for _ in range(A)]+[INF]
    t = [-INF]+[int(input()) for _ in range(B)]+[INF]

    for i in range(Q):
        x=int(input())
        saind = bisect.bisect_left(s,x)
        sa = s[saind-1]
        sb = s[saind]
        taind = bisect.bisect_left(t,x)
        ta = t[taind-1]
        tb = t[taind]

        res = 10**20

        for ss in (sa, sb):
            for tt in (ta, tb):
                res = min(res, abs(x-ss)+abs(ss-tt))
        
        for tt in (ta, tb):
            for ss in (sa, sb):
                res = min(res, abs(x-tt)+abs(tt-ss))


        print(res) def resolve():
    A, B, Q = map(int, input().split())
    INF = 10**20
    s = [-INF]+[int(input()) for _ in range(A)]+[INF]
    t = [-INF]+[int(input()) for _ in range(B)]+[INF]

    for i in range(Q):
        x=int(input())
        saind = bisect.bisect_left(s,x)
        sa = s[saind-1]
        sb = s[saind]
        taind = bisect.bisect_left(t,x)
        ta = t[taind-1]
        tb = t[taind]

        res = 10**20

        for ss in (sa, sb):
            for tt in (ta, tb):
                res = min(res, abs(x-ss)+abs(ss-tt))
        
        for tt in (ta, tb):
            for ss in (sa, sb):
                res = min(res, abs(x-tt)+abs(tt-ss))


        print(res) resolve def input(): return sys.stdin.readline().strip() def input(): return sys.stdin.readline().strip() input
#!/usr/bin/python3
import bisect
# from collections import Counter, deque, OrderedDict, defaultdict
# from copy import copy, deepcopy # pythonのみ．copyは1次元，deepcopyは多次元．
# from functools import reduce
# from heapq import heapify, heappop, heappush
# from itertools import accumulate, permutations, combinations, combinations_with_replacement, groupby, product
# import math
# import numpy as np  # Pythonのみ！
# from operator import xor
# import re
# from scipy.sparse.csgraph import connected_components  # Pythonのみ！
# ↑cf.  https://note.nkmk.me/python-scipy-connected-components/
# from scipy.sparse import csr_matrix
# import statistics # Pythonのみ
# import string
import unittest
from io import StringIO
import sys
sys.setrecursionlimit(10 ** 5 + 10)


def input(): return sys.stdin.readline().strip()


def resolve():
    A, B, Q = map(int, input().split())
    INF = 10**20
    s = [-INF]+[int(input()) for _ in range(A)]+[INF]
    t = [-INF]+[int(input()) for _ in range(B)]+[INF]

    for i in range(Q):
        x=int(input())
        saind = bisect.bisect_left(s,x)
        sa = s[saind-1]
        sb = s[saind]
        taind = bisect.bisect_left(t,x)
        ta = t[taind-1]
        tb = t[taind]

        res = 10**20

        for ss in (sa, sb):
            for tt in (ta, tb):
                res = min(res, abs(x-ss)+abs(ss-tt))
        
        for tt in (ta, tb):
            for ss in (sa, sb):
                res = min(res, abs(x-tt)+abs(tt-ss))


        print(res)


resolve()