# coding: utf-8

# https://atcoder.jp/contests/abc119


def leq_search(xs, x, s, t):
    # x以下で最大のindex
    if t-s <= 3:
        res = 0
        for i in range(s, t):
            if xs[i] <= x:
                res = i
        return res

    i = (s+t)//2
    if xs[i] <= x:
        return leq_search(xs, x, i, t)
    else:
        return leq_search(xs, x, s, i)


def geq_search(xs, x, s, t):
    # x以上で最小のindex
    if t-s <= 3:
        res = 0
        for i in range(t-1, s-1, -1):
            if xs[i] >= x:
                res = i
        return res

    i = (s+t)//2
    if xs[i] >= x:
        return geq_search(xs, x, s, i+1)
    else:
        return geq_search(xs, x, i+1, t)


def nearest_search(xs, x, s, t):
    # xにもっとも近いindex
    if t-s <= 3:
        res = s
        for i in range(s, t):
            if abs(x-xs[i]) < abs(x-xs[res]):
                res = i
        return res

    i = (s+t)//2
    if xs[i] <= x:
        return nearest_search(xs, x, i, t)
    else:
        return nearest_search(xs, x, s, i+1)


def main():
    A, B, Q = map(int, input().split())
    s = [None] * A
    t = [None] * B
    xs = [None] * Q
    for i in range(A):
        s[i] = int(input())
    for i in range(B):
        t[i] = int(input())
    for i in range(Q):
        xs[i] = int(input())

    S, T = 0, 1
    st = [[s[i], S, i] for i in range(A)]
    st.extend([[t[i], T, i] for i in range(B)])
    # st = [[s[i], S, i] for i in range(A)].extend([[t[i], T, i] for i in range(B)])
    st = sorted(st, key=lambda x: x[0])
    st_retrieval = [x[0] for x in st]

    # 各神社から最寄りの寺を求める
    s_near_t = [None] * A
    for i in range(A):
        s_near_t[i] = t[nearest_search(t, s[i], 0, B)]

    # 各寺から最寄りの神社を求める
    t_near_s = [None] * B
    for i in range(B):
        t_near_s[i] = s[nearest_search(s, t[i], 0, A)]

    for x in xs:
        # left
        near_i = leq_search(st_retrieval, x, 0, A+B)
        val, mark, i = st[near_i]
        # val: 座標
        # mark: S or T
        # i: 元の列 s or t の中での index
        cand1 = abs(val-x)
        if mark == S:
            near_t = s_near_t[i]
            cand1 += abs(near_t-val)
        else:
            near_s = t_near_s[i]
            cand1 += abs(near_s-val)

        # right
        near_i = geq_search(st_retrieval, x, 0, A+B)
        val, mark, i = st[near_i]
        # val: 座標
        # mark: S or T
        # i: 元の列 s or t の中での index
        cand2 = abs(val-x)
        if mark == S:
            near_t = s_near_t[i]
            cand2 += abs(near_t-val)
        else:
            near_s = t_near_s[i]
            cand2 += abs(near_s-val)
        
        print(min(cand1, cand2))


main()
# print(main()) def leq_search(xs, x, s, t):
    # x以下で最大のindex
    if t-s <= 3:
        res = 0
        for i in range(s, t):
            if xs[i] <= x:
                res = i
        return res

    i = (s+t)//2
    if xs[i] <= x:
        return leq_search(xs, x, i, t)
    else:
        return leq_search(xs, x, s, i) leq_search if t-s <= 3:
        res = 0
        for i in range(s, t):
            if xs[i] <= x:
                res = i
        return res

     t-s <= 3 t-s t s 3 res = 0 res 0 for i in range(s, t):
            if xs[i] <= x:
                res = i
         i range(s, t) range s t if xs[i] <= x:
                res = i
         xs[i] <= x xs[i] xs i x res = i res i return res res i = (s+t)//2 i (s+t)//2 s+t s t 2 if xs[i] <= x:
        return leq_search(xs, x, i, t)
    else:
        return leq_search(xs, x, s, i) xs[i] <= x xs[i] xs i x return leq_search(xs, x, i, t) leq_search(xs, x, i, t) leq_search xs x i t return leq_search(xs, x, s, i) leq_search(xs, x, s, i) leq_search xs x s i xs xs x x s s t t def geq_search(xs, x, s, t):
    # x以上で最小のindex
    if t-s <= 3:
        res = 0
        for i in range(t-1, s-1, -1):
            if xs[i] >= x:
                res = i
        return res

    i = (s+t)//2
    if xs[i] >= x:
        return geq_search(xs, x, s, i+1)
    else:
        return geq_search(xs, x, i+1, t) geq_search if t-s <= 3:
        res = 0
        for i in range(t-1, s-1, -1):
            if xs[i] >= x:
                res = i
        return res

     t-s <= 3 t-s t s 3 res = 0 res 0 for i in range(t-1, s-1, -1):
            if xs[i] >= x:
                res = i
         i range(t-1, s-1, -1) range t-1 t 1 s-1 s 1 -1 if xs[i] >= x:
                res = i
         xs[i] >= x xs[i] xs i x res = i res i return res res i = (s+t)//2 i (s+t)//2 s+t s t 2 if xs[i] >= x:
        return geq_search(xs, x, s, i+1)
    else:
        return geq_search(xs, x, i+1, t) xs[i] >= x xs[i] xs i x return geq_search(xs, x, s, i+1) geq_search(xs, x, s, i+1) geq_search xs x s i+1 i 1 return geq_search(xs, x, i+1, t) geq_search(xs, x, i+1, t) geq_search xs x i+1 i 1 t xs xs x x s s t t def nearest_search(xs, x, s, t):
    # xにもっとも近いindex
    if t-s <= 3:
        res = s
        for i in range(s, t):
            if abs(x-xs[i]) < abs(x-xs[res]):
                res = i
        return res

    i = (s+t)//2
    if xs[i] <= x:
        return nearest_search(xs, x, i, t)
    else:
        return nearest_search(xs, x, s, i+1) nearest_search if t-s <= 3:
        res = s
        for i in range(s, t):
            if abs(x-xs[i]) < abs(x-xs[res]):
                res = i
        return res

     t-s <= 3 t-s t s 3 res = s res s for i in range(s, t):
            if abs(x-xs[i]) < abs(x-xs[res]):
                res = i
         i range(s, t) range s t if abs(x-xs[i]) < abs(x-xs[res]):
                res = i
         abs(x-xs[i]) < abs(x-xs[res]) abs(x-xs[i]) abs x-xs[i] x xs[i] xs i abs(x-xs[res]) abs x-xs[res] x xs[res] xs res res = i res i return res res i = (s+t)//2 i (s+t)//2 s+t s t 2 if xs[i] <= x:
        return nearest_search(xs, x, i, t)
    else:
        return nearest_search(xs, x, s, i+1) xs[i] <= x xs[i] xs i x return nearest_search(xs, x, i, t) nearest_search(xs, x, i, t) nearest_search xs x i t return nearest_search(xs, x, s, i+1) nearest_search(xs, x, s, i+1) nearest_search xs x s i+1 i 1 xs xs x x s s t t def main():
    A, B, Q = map(int, input().split())
    s = [None] * A
    t = [None] * B
    xs = [None] * Q
    for i in range(A):
        s[i] = int(input())
    for i in range(B):
        t[i] = int(input())
    for i in range(Q):
        xs[i] = int(input())

    S, T = 0, 1
    st = [[s[i], S, i] for i in range(A)]
    st.extend([[t[i], T, i] for i in range(B)])
    # st = [[s[i], S, i] for i in range(A)].extend([[t[i], T, i] for i in range(B)])
    st = sorted(st, key=lambda x: x[0])
    st_retrieval = [x[0] for x in st]

    # 各神社から最寄りの寺を求める
    s_near_t = [None] * A
    for i in range(A):
        s_near_t[i] = t[nearest_search(t, s[i], 0, B)]

    # 各寺から最寄りの神社を求める
    t_near_s = [None] * B
    for i in range(B):
        t_near_s[i] = s[nearest_search(s, t[i], 0, A)]

    for x in xs:
        # left
        near_i = leq_search(st_retrieval, x, 0, A+B)
        val, mark, i = st[near_i]
        # val: 座標
        # mark: S or T
        # i: 元の列 s or t の中での index
        cand1 = abs(val-x)
        if mark == S:
            near_t = s_near_t[i]
            cand1 += abs(near_t-val)
        else:
            near_s = t_near_s[i]
            cand1 += abs(near_s-val)

        # right
        near_i = geq_search(st_retrieval, x, 0, A+B)
        val, mark, i = st[near_i]
        # val: 座標
        # mark: S or T
        # i: 元の列 s or t の中での index
        cand2 = abs(val-x)
        if mark == S:
            near_t = s_near_t[i]
            cand2 += abs(near_t-val)
        else:
            near_s = t_near_s[i]
            cand2 += abs(near_s-val)
        
        print(min(cand1, cand2)) main A, B, Q = map(int, input().split()) A map(int, input().split()) map int input().split() ().split () input split B Q s = [None] * A s [None] * A [None] None A t = [None] * B t [None] * B [None] None B xs = [None] * Q xs [None] * Q [None] None Q for i in range(A):
        s[i] = int(input())
     i range(A) range A s[i] = int(input()) s[i] s i int(input()) int input() input for i in range(B):
        t[i] = int(input())
     i range(B) range B t[i] = int(input()) t[i] t i int(input()) int input() input for i in range(Q):
        xs[i] = int(input())

     i range(Q) range Q xs[i] = int(input()) xs[i] xs i int(input()) int input() input S, T = 0, 1 S 0 T 1 [s[i], S, i] for i in range(A) for i in range(A) i range(A) range A for i in range(A) [s[i], S, i] s[i] s i S i st = [[s[i], S, i] for i in range(A)] st [[s[i], S, i] for i in range(A)] [t[i], T, i] for i in range(B) for i in range(B) i range(B) range B for i in range(B) [t[i], T, i] t[i] t i T i st.extend([[t[i], T, i] for i in range(B)]) st.extend st extend [[t[i], T, i] for i in range(B)] st = sorted(st, key=lambda x: x[0]) st sorted(st, key=lambda x: x[0]) sorted st key=lambda x: x[0] key lambda x: x[0] x[0] x 0 x x[0] for x in st for x in st x st for x in st x[0] x 0 st_retrieval = [x[0] for x in st] st_retrieval [x[0] for x in st] s_near_t = [None] * A s_near_t [None] * A [None] None A for i in range(A):
        s_near_t[i] = t[nearest_search(t, s[i], 0, B)]

    # 各寺から最寄りの神社を求める
     i range(A) range A s_near_t[i] = t[nearest_search(t, s[i], 0, B)] s_near_t[i] s_near_t i t[nearest_search(t, s[i], 0, B)] t nearest_search(t, s[i], 0, B) nearest_search t s[i] s i 0 B t_near_s = [None] * B t_near_s [None] * B [None] None B for i in range(B):
        t_near_s[i] = s[nearest_search(s, t[i], 0, A)]

     i range(B) range B t_near_s[i] = s[nearest_search(s, t[i], 0, A)] t_near_s[i] t_near_s i s[nearest_search(s, t[i], 0, A)] s nearest_search(s, t[i], 0, A) nearest_search s t[i] t i 0 A for x in xs:
        # left
        near_i = leq_search(st_retrieval, x, 0, A+B)
        val, mark, i = st[near_i]
        # val: 座標
        # mark: S or T
        # i: 元の列 s or t の中での index
        cand1 = abs(val-x)
        if mark == S:
            near_t = s_near_t[i]
            cand1 += abs(near_t-val)
        else:
            near_s = t_near_s[i]
            cand1 += abs(near_s-val)

        # right
        near_i = geq_search(st_retrieval, x, 0, A+B)
        val, mark, i = st[near_i]
        # val: 座標
        # mark: S or T
        # i: 元の列 s or t の中での index
        cand2 = abs(val-x)
        if mark == S:
            near_t = s_near_t[i]
            cand2 += abs(near_t-val)
        else:
            near_s = t_near_s[i]
            cand2 += abs(near_s-val)
        
        print(min(cand1, cand2)) x xs near_i = leq_search(st_retrieval, x, 0, A+B) near_i leq_search(st_retrieval, x, 0, A+B) leq_search st_retrieval x 0 A+B A B val, mark, i = st[near_i] val st[near_i] st near_i mark i cand1 = abs(val-x) cand1 abs(val-x) abs val-x val x if mark == S:
            near_t = s_near_t[i]
            cand1 += abs(near_t-val)
        else:
            near_s = t_near_s[i]
            cand1 += abs(near_s-val)

        # right
         mark == S mark S near_t = s_near_t[i] near_t s_near_t[i] s_near_t i cand1 += abs(near_t-val) cand1 abs(near_t-val) abs near_t-val near_t val near_s = t_near_s[i] near_s t_near_s[i] t_near_s i cand1 += abs(near_s-val) cand1 abs(near_s-val) abs near_s-val near_s val near_i = geq_search(st_retrieval, x, 0, A+B) near_i geq_search(st_retrieval, x, 0, A+B) geq_search st_retrieval x 0 A+B A B val, mark, i = st[near_i] val st[near_i] st near_i mark i cand2 = abs(val-x) cand2 abs(val-x) abs val-x val x if mark == S:
            near_t = s_near_t[i]
            cand2 += abs(near_t-val)
        else:
            near_s = t_near_s[i]
            cand2 += abs(near_s-val)
        
         mark == S mark S near_t = s_near_t[i] near_t s_near_t[i] s_near_t i cand2 += abs(near_t-val) cand2 abs(near_t-val) abs near_t-val near_t val near_s = t_near_s[i] near_s t_near_s[i] t_near_s i cand2 += abs(near_s-val) cand2 abs(near_s-val) abs near_s-val near_s val print(min(cand1, cand2)) print min(cand1, cand2) min cand1 cand2 main() main def leq_search(xs, x, s, t):
    # x以下で最大のindex
    if t-s <= 3:
        res = 0
        for i in range(s, t):
            if xs[i] <= x:
                res = i
        return res

    i = (s+t)//2
    if xs[i] <= x:
        return leq_search(xs, x, i, t)
    else:
        return leq_search(xs, x, s, i) def leq_search(xs, x, s, t):
    # x以下で最大のindex
    if t-s <= 3:
        res = 0
        for i in range(s, t):
            if xs[i] <= x:
                res = i
        return res

    i = (s+t)//2
    if xs[i] <= x:
        return leq_search(xs, x, i, t)
    else:
        return leq_search(xs, x, s, i) leq_search def nearest_search(xs, x, s, t):
    # xにもっとも近いindex
    if t-s <= 3:
        res = s
        for i in range(s, t):
            if abs(x-xs[i]) < abs(x-xs[res]):
                res = i
        return res

    i = (s+t)//2
    if xs[i] <= x:
        return nearest_search(xs, x, i, t)
    else:
        return nearest_search(xs, x, s, i+1) def nearest_search(xs, x, s, t):
    # xにもっとも近いindex
    if t-s <= 3:
        res = s
        for i in range(s, t):
            if abs(x-xs[i]) < abs(x-xs[res]):
                res = i
        return res

    i = (s+t)//2
    if xs[i] <= x:
        return nearest_search(xs, x, i, t)
    else:
        return nearest_search(xs, x, s, i+1) nearest_search def geq_search(xs, x, s, t):
    # x以上で最小のindex
    if t-s <= 3:
        res = 0
        for i in range(t-1, s-1, -1):
            if xs[i] >= x:
                res = i
        return res

    i = (s+t)//2
    if xs[i] >= x:
        return geq_search(xs, x, s, i+1)
    else:
        return geq_search(xs, x, i+1, t) def geq_search(xs, x, s, t):
    # x以上で最小のindex
    if t-s <= 3:
        res = 0
        for i in range(t-1, s-1, -1):
            if xs[i] >= x:
                res = i
        return res

    i = (s+t)//2
    if xs[i] >= x:
        return geq_search(xs, x, s, i+1)
    else:
        return geq_search(xs, x, i+1, t) geq_search def main():
    A, B, Q = map(int, input().split())
    s = [None] * A
    t = [None] * B
    xs = [None] * Q
    for i in range(A):
        s[i] = int(input())
    for i in range(B):
        t[i] = int(input())
    for i in range(Q):
        xs[i] = int(input())

    S, T = 0, 1
    st = [[s[i], S, i] for i in range(A)]
    st.extend([[t[i], T, i] for i in range(B)])
    # st = [[s[i], S, i] for i in range(A)].extend([[t[i], T, i] for i in range(B)])
    st = sorted(st, key=lambda x: x[0])
    st_retrieval = [x[0] for x in st]

    # 各神社から最寄りの寺を求める
    s_near_t = [None] * A
    for i in range(A):
        s_near_t[i] = t[nearest_search(t, s[i], 0, B)]

    # 各寺から最寄りの神社を求める
    t_near_s = [None] * B
    for i in range(B):
        t_near_s[i] = s[nearest_search(s, t[i], 0, A)]

    for x in xs:
        # left
        near_i = leq_search(st_retrieval, x, 0, A+B)
        val, mark, i = st[near_i]
        # val: 座標
        # mark: S or T
        # i: 元の列 s or t の中での index
        cand1 = abs(val-x)
        if mark == S:
            near_t = s_near_t[i]
            cand1 += abs(near_t-val)
        else:
            near_s = t_near_s[i]
            cand1 += abs(near_s-val)

        # right
        near_i = geq_search(st_retrieval, x, 0, A+B)
        val, mark, i = st[near_i]
        # val: 座標
        # mark: S or T
        # i: 元の列 s or t の中での index
        cand2 = abs(val-x)
        if mark == S:
            near_t = s_near_t[i]
            cand2 += abs(near_t-val)
        else:
            near_s = t_near_s[i]
            cand2 += abs(near_s-val)
        
        print(min(cand1, cand2)) def main():
    A, B, Q = map(int, input().split())
    s = [None] * A
    t = [None] * B
    xs = [None] * Q
    for i in range(A):
        s[i] = int(input())
    for i in range(B):
        t[i] = int(input())
    for i in range(Q):
        xs[i] = int(input())

    S, T = 0, 1
    st = [[s[i], S, i] for i in range(A)]
    st.extend([[t[i], T, i] for i in range(B)])
    # st = [[s[i], S, i] for i in range(A)].extend([[t[i], T, i] for i in range(B)])
    st = sorted(st, key=lambda x: x[0])
    st_retrieval = [x[0] for x in st]

    # 各神社から最寄りの寺を求める
    s_near_t = [None] * A
    for i in range(A):
        s_near_t[i] = t[nearest_search(t, s[i], 0, B)]

    # 各寺から最寄りの神社を求める
    t_near_s = [None] * B
    for i in range(B):
        t_near_s[i] = s[nearest_search(s, t[i], 0, A)]

    for x in xs:
        # left
        near_i = leq_search(st_retrieval, x, 0, A+B)
        val, mark, i = st[near_i]
        # val: 座標
        # mark: S or T
        # i: 元の列 s or t の中での index
        cand1 = abs(val-x)
        if mark == S:
            near_t = s_near_t[i]
            cand1 += abs(near_t-val)
        else:
            near_s = t_near_s[i]
            cand1 += abs(near_s-val)

        # right
        near_i = geq_search(st_retrieval, x, 0, A+B)
        val, mark, i = st[near_i]
        # val: 座標
        # mark: S or T
        # i: 元の列 s or t の中での index
        cand2 = abs(val-x)
        if mark == S:
            near_t = s_near_t[i]
            cand2 += abs(near_t-val)
        else:
            near_s = t_near_s[i]
            cand2 += abs(near_s-val)
        
        print(min(cand1, cand2)) main
# coding: utf-8

# https://atcoder.jp/contests/abc119


def leq_search(xs, x, s, t):
    # x以下で最大のindex
    if t-s <= 3:
        res = 0
        for i in range(s, t):
            if xs[i] <= x:
                res = i
        return res

    i = (s+t)//2
    if xs[i] <= x:
        return leq_search(xs, x, i, t)
    else:
        return leq_search(xs, x, s, i)


def geq_search(xs, x, s, t):
    # x以上で最小のindex
    if t-s <= 3:
        res = 0
        for i in range(t-1, s-1, -1):
            if xs[i] >= x:
                res = i
        return res

    i = (s+t)//2
    if xs[i] >= x:
        return geq_search(xs, x, s, i+1)
    else:
        return geq_search(xs, x, i+1, t)


def nearest_search(xs, x, s, t):
    # xにもっとも近いindex
    if t-s <= 3:
        res = s
        for i in range(s, t):
            if abs(x-xs[i]) < abs(x-xs[res]):
                res = i
        return res

    i = (s+t)//2
    if xs[i] <= x:
        return nearest_search(xs, x, i, t)
    else:
        return nearest_search(xs, x, s, i+1)


def main():
    A, B, Q = map(int, input().split())
    s = [None] * A
    t = [None] * B
    xs = [None] * Q
    for i in range(A):
        s[i] = int(input())
    for i in range(B):
        t[i] = int(input())
    for i in range(Q):
        xs[i] = int(input())

    S, T = 0, 1
    st = [[s[i], S, i] for i in range(A)]
    st.extend([[t[i], T, i] for i in range(B)])
    # st = [[s[i], S, i] for i in range(A)].extend([[t[i], T, i] for i in range(B)])
    st = sorted(st, key=lambda x: x[0])
    st_retrieval = [x[0] for x in st]

    # 各神社から最寄りの寺を求める
    s_near_t = [None] * A
    for i in range(A):
        s_near_t[i] = t[nearest_search(t, s[i], 0, B)]

    # 各寺から最寄りの神社を求める
    t_near_s = [None] * B
    for i in range(B):
        t_near_s[i] = s[nearest_search(s, t[i], 0, A)]

    for x in xs:
        # left
        near_i = leq_search(st_retrieval, x, 0, A+B)
        val, mark, i = st[near_i]
        # val: 座標
        # mark: S or T
        # i: 元の列 s or t の中での index
        cand1 = abs(val-x)
        if mark == S:
            near_t = s_near_t[i]
            cand1 += abs(near_t-val)
        else:
            near_s = t_near_s[i]
            cand1 += abs(near_s-val)

        # right
        near_i = geq_search(st_retrieval, x, 0, A+B)
        val, mark, i = st[near_i]
        # val: 座標
        # mark: S or T
        # i: 元の列 s or t の中での index
        cand2 = abs(val-x)
        if mark == S:
            near_t = s_near_t[i]
            cand2 += abs(near_t-val)
        else:
            near_s = t_near_s[i]
            cand2 += abs(near_s-val)
        
        print(min(cand1, cand2))


main()
# print(main())
