import bisect
import sys
input = sys.stdin.readline

def main():
    a,b,q = map(int,input().split())
    s = []
    t = []
    s1 = []
    t1 = []

    for _ in range(a):
        s.append(int(input()))
    for _ in range(b):
        t.append(int(input()))

    for i in range(a-1):
        s1.append((s[i]+s[i+1])/2)
    for i in range(b-1):
        t1.append((t[i]+t[i+1])/2)

    for _ in range(q):
        x = int(input())
        s_index = bisect.bisect_left(s1, x)
        t_index = bisect.bisect_left(t1, x)
        xs = []
        xt = []
        for i in range(-2, 3):
            if 0 <= s_index + i < a:
                xs.append(s[s_index+i])
            if 0 <= t_index + i < b:
                xt.append(t[t_index+i])
        ans = 10**20
        for i in xs:
            for j in xt:
                ans = min(ans, abs(x-i) + abs(i-j), abs(x-j) + abs(j-i))

        print(ans)

if __name__ == '__main__':
    main() import bisect bisect import sys sys input = sys.stdin.readline input sys.stdin.readline sys.stdin sys stdin readline def main():
    a,b,q = map(int,input().split())
    s = []
    t = []
    s1 = []
    t1 = []

    for _ in range(a):
        s.append(int(input()))
    for _ in range(b):
        t.append(int(input()))

    for i in range(a-1):
        s1.append((s[i]+s[i+1])/2)
    for i in range(b-1):
        t1.append((t[i]+t[i+1])/2)

    for _ in range(q):
        x = int(input())
        s_index = bisect.bisect_left(s1, x)
        t_index = bisect.bisect_left(t1, x)
        xs = []
        xt = []
        for i in range(-2, 3):
            if 0 <= s_index + i < a:
                xs.append(s[s_index+i])
            if 0 <= t_index + i < b:
                xt.append(t[t_index+i])
        ans = 10**20
        for i in xs:
            for j in xt:
                ans = min(ans, abs(x-i) + abs(i-j), abs(x-j) + abs(j-i))

        print(ans) main a,b,q = map(int,input().split()) a map(int,input().split()) map int input().split() ().split () input split b q s = [] s [] t = [] t [] s1 = [] s1 [] t1 = [] t1 [] for _ in range(a):
        s.append(int(input()))
     _ range(a) range a s.append(int(input())) s.append s append int(input()) int input() input for _ in range(b):
        t.append(int(input()))

     _ range(b) range b t.append(int(input())) t.append t append int(input()) int input() input for i in range(a-1):
        s1.append((s[i]+s[i+1])/2)
     i range(a-1) range a-1 a 1 s1.append((s[i]+s[i+1])/2) s1.append s1 append (s[i]+s[i+1])/2 s[i]+s[i+1] s[i] s i s[i+1] s i+1 i 1 2 for i in range(b-1):
        t1.append((t[i]+t[i+1])/2)

     i range(b-1) range b-1 b 1 t1.append((t[i]+t[i+1])/2) t1.append t1 append (t[i]+t[i+1])/2 t[i]+t[i+1] t[i] t i t[i+1] t i+1 i 1 2 for _ in range(q):
        x = int(input())
        s_index = bisect.bisect_left(s1, x)
        t_index = bisect.bisect_left(t1, x)
        xs = []
        xt = []
        for i in range(-2, 3):
            if 0 <= s_index + i < a:
                xs.append(s[s_index+i])
            if 0 <= t_index + i < b:
                xt.append(t[t_index+i])
        ans = 10**20
        for i in xs:
            for j in xt:
                ans = min(ans, abs(x-i) + abs(i-j), abs(x-j) + abs(j-i))

        print(ans) _ range(q) range q x = int(input()) x int(input()) int input() input s_index = bisect.bisect_left(s1, x) s_index bisect.bisect_left(s1, x) bisect.bisect_left bisect bisect_left s1 x t_index = bisect.bisect_left(t1, x) t_index bisect.bisect_left(t1, x) bisect.bisect_left bisect bisect_left t1 x xs = [] xs [] xt = [] xt [] for i in range(-2, 3):
            if 0 <= s_index + i < a:
                xs.append(s[s_index+i])
            if 0 <= t_index + i < b:
                xt.append(t[t_index+i])
         i range(-2, 3) range -2 3 if 0 <= s_index + i < a:
                xs.append(s[s_index+i])
             0 <= s_index + i < a 0 <= s_index + i 0 s_index + i s_index i a xs.append(s[s_index+i]) xs.append xs append s[s_index+i] s s_index+i s_index i if 0 <= t_index + i < b:
                xt.append(t[t_index+i])
         0 <= t_index + i < b 0 <= t_index + i 0 t_index + i t_index i b xt.append(t[t_index+i]) xt.append xt append t[t_index+i] t t_index+i t_index i ans = 10**20 ans 10**20 10 20 for i in xs:
            for j in xt:
                ans = min(ans, abs(x-i) + abs(i-j), abs(x-j) + abs(j-i))

         i xs for j in xt:
                ans = min(ans, abs(x-i) + abs(i-j), abs(x-j) + abs(j-i))

         j xt ans = min(ans, abs(x-i) + abs(i-j), abs(x-j) + abs(j-i)) ans min(ans, abs(x-i) + abs(i-j), abs(x-j) + abs(j-i)) min ans abs(x-i) + abs(i-j) abs(x-i) abs x-i x i abs(i-j) abs i-j i j abs(x-j) + abs(j-i) abs(x-j) abs x-j x j abs(j-i) abs j-i j i print(ans) print ans if __name__ == '__main__':
    main() __name__ == '__main__' __name__ '__main__' main() main def main():
    a,b,q = map(int,input().split())
    s = []
    t = []
    s1 = []
    t1 = []

    for _ in range(a):
        s.append(int(input()))
    for _ in range(b):
        t.append(int(input()))

    for i in range(a-1):
        s1.append((s[i]+s[i+1])/2)
    for i in range(b-1):
        t1.append((t[i]+t[i+1])/2)

    for _ in range(q):
        x = int(input())
        s_index = bisect.bisect_left(s1, x)
        t_index = bisect.bisect_left(t1, x)
        xs = []
        xt = []
        for i in range(-2, 3):
            if 0 <= s_index + i < a:
                xs.append(s[s_index+i])
            if 0 <= t_index + i < b:
                xt.append(t[t_index+i])
        ans = 10**20
        for i in xs:
            for j in xt:
                ans = min(ans, abs(x-i) + abs(i-j), abs(x-j) + abs(j-i))

        print(ans) def main():
    a,b,q = map(int,input().split())
    s = []
    t = []
    s1 = []
    t1 = []

    for _ in range(a):
        s.append(int(input()))
    for _ in range(b):
        t.append(int(input()))

    for i in range(a-1):
        s1.append((s[i]+s[i+1])/2)
    for i in range(b-1):
        t1.append((t[i]+t[i+1])/2)

    for _ in range(q):
        x = int(input())
        s_index = bisect.bisect_left(s1, x)
        t_index = bisect.bisect_left(t1, x)
        xs = []
        xt = []
        for i in range(-2, 3):
            if 0 <= s_index + i < a:
                xs.append(s[s_index+i])
            if 0 <= t_index + i < b:
                xt.append(t[t_index+i])
        ans = 10**20
        for i in xs:
            for j in xt:
                ans = min(ans, abs(x-i) + abs(i-j), abs(x-j) + abs(j-i))

        print(ans) main input = sys.stdin.readline sys.stdin.readline input
import bisect
import sys
input = sys.stdin.readline

def main():
    a,b,q = map(int,input().split())
    s = []
    t = []
    s1 = []
    t1 = []

    for _ in range(a):
        s.append(int(input()))
    for _ in range(b):
        t.append(int(input()))

    for i in range(a-1):
        s1.append((s[i]+s[i+1])/2)
    for i in range(b-1):
        t1.append((t[i]+t[i+1])/2)

    for _ in range(q):
        x = int(input())
        s_index = bisect.bisect_left(s1, x)
        t_index = bisect.bisect_left(t1, x)
        xs = []
        xt = []
        for i in range(-2, 3):
            if 0 <= s_index + i < a:
                xs.append(s[s_index+i])
            if 0 <= t_index + i < b:
                xt.append(t[t_index+i])
        ans = 10**20
        for i in xs:
            for j in xt:
                ans = min(ans, abs(x-i) + abs(i-j), abs(x-j) + abs(j-i))

        print(ans)

if __name__ == '__main__':
    main()