import bisect
a, b, q = map(int, input().split())
INF = 10**18
shrines = [-INF]+[int(input())for _ in range(a)]
temples = [-INF]+[int(input())for _ in range(b)]

for _ in range(q):
    x = int(input())

    ans = INF
    # 神社→寺
    Ri = bisect.bisect_left(shrines, x)
    Li = Ri-1
    if Ri != a+1:
        R = shrines[Ri]
        Rj = bisect.bisect_left(temples, R)
        Lj = Rj-1
        d = INF
        if Rj != b+1:
            d = min(d, temples[Rj]-x)
        if Lj != 0:
            d = min(d, R-temples[Lj]+R-x)
        if d < ans:
            ans = d
    if Li != 0:
        L = shrines[Li]
        Rj = bisect.bisect_left(temples, L)
        Lj = Rj-1
        d = INF
        if Rj != b+1:
            d = min(d, temples[Rj]-L+x-L)
        if Lj != 0:
            d = min(d, x-temples[Lj])
        if d < ans:
            ans = d

    # 寺→神社
    Ri = bisect.bisect_left(temples, x)
    Li = Ri-1
    if Ri != b+1:
        R = temples[Ri]
        Rj = bisect.bisect_left(shrines, R)
        Lj = Rj-1
        d = INF
        if Rj != a+1:
            d = min(d, shrines[Rj]-x)
        if Lj != 0:
            d = min(d, R-shrines[Lj]+R-x)
        if d < ans:
            ans = d
    if Li != 0:
        L = temples[Li]
        Rj = bisect.bisect_left(shrines, L)
        Lj = Rj-1
        d = INF
        if Rj != a+1:
            d = min(d, shrines[Rj]-L+x-L)
        if Lj != 0:
            d = min(d, x-shrines[Lj])
        if d < ans:
            ans = d

    print(ans) import bisect bisect a, b, q = map(int, input().split()) a map(int, input().split()) map int input().split() ().split () input split b q INF = 10**18 INF 10**18 10 18 int(input())for _ in range(a) for _ in range(a) _ range(a) range a for _ in range(a) int(input()) int input() input shrines = [-INF]+[int(input())for _ in range(a)] shrines [-INF]+[int(input())for _ in range(a)] [-INF] -INF INF [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 temples = [-INF]+[int(input())for _ in range(b)] temples [-INF]+[int(input())for _ in range(b)] [-INF] -INF INF [int(input())for _ in range(b)] for _ in range(q):
    x = int(input())

    ans = INF
    # 神社→寺
    Ri = bisect.bisect_left(shrines, x)
    Li = Ri-1
    if Ri != a+1:
        R = shrines[Ri]
        Rj = bisect.bisect_left(temples, R)
        Lj = Rj-1
        d = INF
        if Rj != b+1:
            d = min(d, temples[Rj]-x)
        if Lj != 0:
            d = min(d, R-temples[Lj]+R-x)
        if d < ans:
            ans = d
    if Li != 0:
        L = shrines[Li]
        Rj = bisect.bisect_left(temples, L)
        Lj = Rj-1
        d = INF
        if Rj != b+1:
            d = min(d, temples[Rj]-L+x-L)
        if Lj != 0:
            d = min(d, x-temples[Lj])
        if d < ans:
            ans = d

    # 寺→神社
    Ri = bisect.bisect_left(temples, x)
    Li = Ri-1
    if Ri != b+1:
        R = temples[Ri]
        Rj = bisect.bisect_left(shrines, R)
        Lj = Rj-1
        d = INF
        if Rj != a+1:
            d = min(d, shrines[Rj]-x)
        if Lj != 0:
            d = min(d, R-shrines[Lj]+R-x)
        if d < ans:
            ans = d
    if Li != 0:
        L = temples[Li]
        Rj = bisect.bisect_left(shrines, L)
        Lj = Rj-1
        d = INF
        if Rj != a+1:
            d = min(d, shrines[Rj]-L+x-L)
        if Lj != 0:
            d = min(d, x-shrines[Lj])
        if d < ans:
            ans = d

    print(ans) _ range(q) range q x = int(input()) x int(input()) int input() input ans = INF ans INF Ri = bisect.bisect_left(shrines, x) Ri bisect.bisect_left(shrines, x) bisect.bisect_left bisect bisect_left shrines x Li = Ri-1 Li Ri-1 Ri 1 if Ri != a+1:
        R = shrines[Ri]
        Rj = bisect.bisect_left(temples, R)
        Lj = Rj-1
        d = INF
        if Rj != b+1:
            d = min(d, temples[Rj]-x)
        if Lj != 0:
            d = min(d, R-temples[Lj]+R-x)
        if d < ans:
            ans = d
     Ri != a+1 Ri a+1 a 1 R = shrines[Ri] R shrines[Ri] shrines Ri Rj = bisect.bisect_left(temples, R) Rj bisect.bisect_left(temples, R) bisect.bisect_left bisect bisect_left temples R Lj = Rj-1 Lj Rj-1 Rj 1 d = INF d INF if Rj != b+1:
            d = min(d, temples[Rj]-x)
         Rj != b+1 Rj b+1 b 1 d = min(d, temples[Rj]-x) d min(d, temples[Rj]-x) min d temples[Rj]-x temples[Rj] temples Rj x if Lj != 0:
            d = min(d, R-temples[Lj]+R-x)
         Lj != 0 Lj 0 d = min(d, R-temples[Lj]+R-x) d min(d, R-temples[Lj]+R-x) min d R-temples[Lj]+R-x R-temples[Lj]+R R-temples[Lj] R temples[Lj] temples Lj R x if d < ans:
            ans = d
     d < ans d ans ans = d ans d if Li != 0:
        L = shrines[Li]
        Rj = bisect.bisect_left(temples, L)
        Lj = Rj-1
        d = INF
        if Rj != b+1:
            d = min(d, temples[Rj]-L+x-L)
        if Lj != 0:
            d = min(d, x-temples[Lj])
        if d < ans:
            ans = d

    # 寺→神社
     Li != 0 Li 0 L = shrines[Li] L shrines[Li] shrines Li Rj = bisect.bisect_left(temples, L) Rj bisect.bisect_left(temples, L) bisect.bisect_left bisect bisect_left temples L Lj = Rj-1 Lj Rj-1 Rj 1 d = INF d INF if Rj != b+1:
            d = min(d, temples[Rj]-L+x-L)
         Rj != b+1 Rj b+1 b 1 d = min(d, temples[Rj]-L+x-L) d min(d, temples[Rj]-L+x-L) min d temples[Rj]-L+x-L temples[Rj]-L+x temples[Rj]-L temples[Rj] temples Rj L x L if Lj != 0:
            d = min(d, x-temples[Lj])
         Lj != 0 Lj 0 d = min(d, x-temples[Lj]) d min(d, x-temples[Lj]) min d x-temples[Lj] x temples[Lj] temples Lj if d < ans:
            ans = d

    # 寺→神社
     d < ans d ans ans = d ans d Ri = bisect.bisect_left(temples, x) Ri bisect.bisect_left(temples, x) bisect.bisect_left bisect bisect_left temples x Li = Ri-1 Li Ri-1 Ri 1 if Ri != b+1:
        R = temples[Ri]
        Rj = bisect.bisect_left(shrines, R)
        Lj = Rj-1
        d = INF
        if Rj != a+1:
            d = min(d, shrines[Rj]-x)
        if Lj != 0:
            d = min(d, R-shrines[Lj]+R-x)
        if d < ans:
            ans = d
     Ri != b+1 Ri b+1 b 1 R = temples[Ri] R temples[Ri] temples Ri Rj = bisect.bisect_left(shrines, R) Rj bisect.bisect_left(shrines, R) bisect.bisect_left bisect bisect_left shrines R Lj = Rj-1 Lj Rj-1 Rj 1 d = INF d INF if Rj != a+1:
            d = min(d, shrines[Rj]-x)
         Rj != a+1 Rj a+1 a 1 d = min(d, shrines[Rj]-x) d min(d, shrines[Rj]-x) min d shrines[Rj]-x shrines[Rj] shrines Rj x if Lj != 0:
            d = min(d, R-shrines[Lj]+R-x)
         Lj != 0 Lj 0 d = min(d, R-shrines[Lj]+R-x) d min(d, R-shrines[Lj]+R-x) min d R-shrines[Lj]+R-x R-shrines[Lj]+R R-shrines[Lj] R shrines[Lj] shrines Lj R x if d < ans:
            ans = d
     d < ans d ans ans = d ans d if Li != 0:
        L = temples[Li]
        Rj = bisect.bisect_left(shrines, L)
        Lj = Rj-1
        d = INF
        if Rj != a+1:
            d = min(d, shrines[Rj]-L+x-L)
        if Lj != 0:
            d = min(d, x-shrines[Lj])
        if d < ans:
            ans = d

     Li != 0 Li 0 L = temples[Li] L temples[Li] temples Li Rj = bisect.bisect_left(shrines, L) Rj bisect.bisect_left(shrines, L) bisect.bisect_left bisect bisect_left shrines L Lj = Rj-1 Lj Rj-1 Rj 1 d = INF d INF if Rj != a+1:
            d = min(d, shrines[Rj]-L+x-L)
         Rj != a+1 Rj a+1 a 1 d = min(d, shrines[Rj]-L+x-L) d min(d, shrines[Rj]-L+x-L) min d shrines[Rj]-L+x-L shrines[Rj]-L+x shrines[Rj]-L shrines[Rj] shrines Rj L x L if Lj != 0:
            d = min(d, x-shrines[Lj])
         Lj != 0 Lj 0 d = min(d, x-shrines[Lj]) d min(d, x-shrines[Lj]) min d x-shrines[Lj] x shrines[Lj] shrines Lj if d < ans:
            ans = d

     d < ans d ans ans = d ans d print(ans) print ans shrines = [-INF]+[int(input())for _ in range(a)] [-INF]+[int(input())for _ in range(a)] shrines x = int(input()) int(input()) x Lj = Rj-1 Rj-1 Lj Ri = bisect.bisect_left(temples, x) bisect.bisect_left(temples, x) Ri a, b, q = map(int, input().split()) map(int, input().split()) a Li = Ri-1 Ri-1 Li d = INF INF d q = map(int, input().split()) map(int, input().split()) q Lj = Rj-1 Rj-1 Lj d = min(d, x-shrines[Lj]) min(d, x-shrines[Lj]) d Rj = bisect.bisect_left(shrines, R) bisect.bisect_left(shrines, R) Rj Rj = bisect.bisect_left(shrines, L) bisect.bisect_left(shrines, L) Rj ans = d d ans d = INF INF d Lj = Rj-1 Rj-1 Lj Lj = Rj-1 Rj-1 Lj d = min(d, x-temples[Lj]) min(d, x-temples[Lj]) d d = INF INF d ans = d d ans d = min(d, shrines[Rj]-x) min(d, shrines[Rj]-x) d ans = d d ans d = min(d, temples[Rj]-x) min(d, temples[Rj]-x) d d = min(d, R-temples[Lj]+R-x) min(d, R-temples[Lj]+R-x) d d = min(d, R-shrines[Lj]+R-x) min(d, R-shrines[Lj]+R-x) d b, q = map(int, input().split()) map(int, input().split()) b L = temples[Li] temples[Li] L Rj = bisect.bisect_left(temples, R) bisect.bisect_left(temples, R) Rj Ri = bisect.bisect_left(shrines, x) bisect.bisect_left(shrines, x) Ri Li = Ri-1 Ri-1 Li temples = [-INF]+[int(input())for _ in range(b)] [-INF]+[int(input())for _ in range(b)] temples Rj = bisect.bisect_left(temples, L) bisect.bisect_left(temples, L) Rj d = min(d, shrines[Rj]-L+x-L) min(d, shrines[Rj]-L+x-L) d ans = INF INF ans d = min(d, temples[Rj]-L+x-L) min(d, temples[Rj]-L+x-L) d R = temples[Ri] temples[Ri] R R = shrines[Ri] shrines[Ri] R L = shrines[Li] shrines[Li] L ans = d d ans d = INF INF d INF = 10**18 10**18 INF
import bisect
a, b, q = map(int, input().split())
INF = 10**18
shrines = [-INF]+[int(input())for _ in range(a)]
temples = [-INF]+[int(input())for _ in range(b)]

for _ in range(q):
    x = int(input())

    ans = INF
    # 神社→寺
    Ri = bisect.bisect_left(shrines, x)
    Li = Ri-1
    if Ri != a+1:
        R = shrines[Ri]
        Rj = bisect.bisect_left(temples, R)
        Lj = Rj-1
        d = INF
        if Rj != b+1:
            d = min(d, temples[Rj]-x)
        if Lj != 0:
            d = min(d, R-temples[Lj]+R-x)
        if d < ans:
            ans = d
    if Li != 0:
        L = shrines[Li]
        Rj = bisect.bisect_left(temples, L)
        Lj = Rj-1
        d = INF
        if Rj != b+1:
            d = min(d, temples[Rj]-L+x-L)
        if Lj != 0:
            d = min(d, x-temples[Lj])
        if d < ans:
            ans = d

    # 寺→神社
    Ri = bisect.bisect_left(temples, x)
    Li = Ri-1
    if Ri != b+1:
        R = temples[Ri]
        Rj = bisect.bisect_left(shrines, R)
        Lj = Rj-1
        d = INF
        if Rj != a+1:
            d = min(d, shrines[Rj]-x)
        if Lj != 0:
            d = min(d, R-shrines[Lj]+R-x)
        if d < ans:
            ans = d
    if Li != 0:
        L = temples[Li]
        Rj = bisect.bisect_left(shrines, L)
        Lj = Rj-1
        d = INF
        if Rj != a+1:
            d = min(d, shrines[Rj]-L+x-L)
        if Lj != 0:
            d = min(d, x-shrines[Lj])
        if d < ans:
            ans = d

    print(ans)
