import bisect

a, b, q = map(int, input().split())
ans = 0

shrine = []
temple = []

for i in range(a):
    s = int(input())
    shrine.append(s)

for i in range(b):
    t = int(input())
    temple.append(t)


for j in range(q):
    shrine_list = []
    temple_list = []
    query = int(input())
    shrine_index = bisect.bisect_left(shrine, query)
    temple_index = bisect.bisect_left(temple, query)
    if shrine_index == 0:
        shrine_list.append(shrine[shrine_index])
    elif shrine_index == len(shrine):
        shrine_list.append(shrine[shrine_index-1])
    else:
        shrine_list.append(shrine[shrine_index])
        shrine_list.append(shrine[shrine_index-1])
    if temple_index == 0:
        temple_list.append(temple[temple_index])
    elif temple_index == len(temple):
        temple_list.append(temple[temple_index-1])
    else:
        temple_list.append(temple[temple_index])
        temple_list.append(temple[temple_index-1])
    min_dist = 10**12
    for sh in shrine_list:
        for tm in temple_list:
            if sh < query < tm:
                dist = min(tm - sh + (query - sh), tm - sh + (tm - query))
            elif tm < query < sh:
                dist = min(sh - tm + (query - tm), sh - tm + (sh - query))
            elif min(query, sh, tm) == query:
                dist = max(sh, tm) - query
            elif max(query, sh, tm) == query:
                dist = query - min(sh, tm)
            if dist < min_dist:
                min_dist = dist
    print(min_dist)
 import bisect bisect a, b, q = map(int, input().split()) a map(int, input().split()) map int input().split() ().split () input split b q ans = 0 ans 0 shrine = [] shrine [] temple = [] temple [] for i in range(a):
    s = int(input())
    shrine.append(s) i range(a) range a s = int(input()) s int(input()) int input() input shrine.append(s) shrine.append shrine append s for i in range(b):
    t = int(input())
    temple.append(t) i range(b) range b t = int(input()) t int(input()) int input() input temple.append(t) temple.append temple append t for j in range(q):
    shrine_list = []
    temple_list = []
    query = int(input())
    shrine_index = bisect.bisect_left(shrine, query)
    temple_index = bisect.bisect_left(temple, query)
    if shrine_index == 0:
        shrine_list.append(shrine[shrine_index])
    elif shrine_index == len(shrine):
        shrine_list.append(shrine[shrine_index-1])
    else:
        shrine_list.append(shrine[shrine_index])
        shrine_list.append(shrine[shrine_index-1])
    if temple_index == 0:
        temple_list.append(temple[temple_index])
    elif temple_index == len(temple):
        temple_list.append(temple[temple_index-1])
    else:
        temple_list.append(temple[temple_index])
        temple_list.append(temple[temple_index-1])
    min_dist = 10**12
    for sh in shrine_list:
        for tm in temple_list:
            if sh < query < tm:
                dist = min(tm - sh + (query - sh), tm - sh + (tm - query))
            elif tm < query < sh:
                dist = min(sh - tm + (query - tm), sh - tm + (sh - query))
            elif min(query, sh, tm) == query:
                dist = max(sh, tm) - query
            elif max(query, sh, tm) == query:
                dist = query - min(sh, tm)
            if dist < min_dist:
                min_dist = dist
    print(min_dist) j range(q) range q shrine_list = [] shrine_list [] temple_list = [] temple_list [] query = int(input()) query int(input()) int input() input shrine_index = bisect.bisect_left(shrine, query) shrine_index bisect.bisect_left(shrine, query) bisect.bisect_left bisect bisect_left shrine query temple_index = bisect.bisect_left(temple, query) temple_index bisect.bisect_left(temple, query) bisect.bisect_left bisect bisect_left temple query if shrine_index == 0:
        shrine_list.append(shrine[shrine_index])
    elif shrine_index == len(shrine):
        shrine_list.append(shrine[shrine_index-1])
    else:
        shrine_list.append(shrine[shrine_index])
        shrine_list.append(shrine[shrine_index-1])
     shrine_index == 0 shrine_index 0 shrine_list.append(shrine[shrine_index]) shrine_list.append shrine_list append shrine[shrine_index] shrine shrine_index elif shrine_index == len(shrine):
        shrine_list.append(shrine[shrine_index-1])
     shrine_index == len(shrine) shrine_index len(shrine) len shrine shrine_list.append(shrine[shrine_index-1]) shrine_list.append shrine_list append shrine[shrine_index-1] shrine shrine_index-1 shrine_index 1 shrine_list.append(shrine[shrine_index]) shrine_list.append shrine_list append shrine[shrine_index] shrine shrine_index shrine_list.append(shrine[shrine_index-1]) shrine_list.append shrine_list append shrine[shrine_index-1] shrine shrine_index-1 shrine_index 1 if temple_index == 0:
        temple_list.append(temple[temple_index])
    elif temple_index == len(temple):
        temple_list.append(temple[temple_index-1])
    else:
        temple_list.append(temple[temple_index])
        temple_list.append(temple[temple_index-1])
     temple_index == 0 temple_index 0 temple_list.append(temple[temple_index]) temple_list.append temple_list append temple[temple_index] temple temple_index elif temple_index == len(temple):
        temple_list.append(temple[temple_index-1])
     temple_index == len(temple) temple_index len(temple) len temple temple_list.append(temple[temple_index-1]) temple_list.append temple_list append temple[temple_index-1] temple temple_index-1 temple_index 1 temple_list.append(temple[temple_index]) temple_list.append temple_list append temple[temple_index] temple temple_index temple_list.append(temple[temple_index-1]) temple_list.append temple_list append temple[temple_index-1] temple temple_index-1 temple_index 1 min_dist = 10**12 min_dist 10**12 10 12 for sh in shrine_list:
        for tm in temple_list:
            if sh < query < tm:
                dist = min(tm - sh + (query - sh), tm - sh + (tm - query))
            elif tm < query < sh:
                dist = min(sh - tm + (query - tm), sh - tm + (sh - query))
            elif min(query, sh, tm) == query:
                dist = max(sh, tm) - query
            elif max(query, sh, tm) == query:
                dist = query - min(sh, tm)
            if dist < min_dist:
                min_dist = dist
     sh shrine_list for tm in temple_list:
            if sh < query < tm:
                dist = min(tm - sh + (query - sh), tm - sh + (tm - query))
            elif tm < query < sh:
                dist = min(sh - tm + (query - tm), sh - tm + (sh - query))
            elif min(query, sh, tm) == query:
                dist = max(sh, tm) - query
            elif max(query, sh, tm) == query:
                dist = query - min(sh, tm)
            if dist < min_dist:
                min_dist = dist
     tm temple_list if sh < query < tm:
                dist = min(tm - sh + (query - sh), tm - sh + (tm - query))
            elif tm < query < sh:
                dist = min(sh - tm + (query - tm), sh - tm + (sh - query))
            elif min(query, sh, tm) == query:
                dist = max(sh, tm) - query
            elif max(query, sh, tm) == query:
                dist = query - min(sh, tm)
             sh < query < tm sh < query sh query tm dist = min(tm - sh + (query - sh), tm - sh + (tm - query)) dist min(tm - sh + (query - sh), tm - sh + (tm - query)) min tm - sh + (query - sh) tm - sh tm sh query - sh query sh tm - sh + (tm - query) tm - sh tm sh tm - query tm query elif tm < query < sh:
                dist = min(sh - tm + (query - tm), sh - tm + (sh - query))
             tm < query < sh tm < query tm query sh dist = min(sh - tm + (query - tm), sh - tm + (sh - query)) dist min(sh - tm + (query - tm), sh - tm + (sh - query)) min sh - tm + (query - tm) sh - tm sh tm query - tm query tm sh - tm + (sh - query) sh - tm sh tm sh - query sh query elif min(query, sh, tm) == query:
                dist = max(sh, tm) - query
             min(query, sh, tm) == query min(query, sh, tm) min query sh tm query dist = max(sh, tm) - query dist max(sh, tm) - query max(sh, tm) max sh tm query elif max(query, sh, tm) == query:
                dist = query - min(sh, tm)
             max(query, sh, tm) == query max(query, sh, tm) max query sh tm query dist = query - min(sh, tm) dist query - min(sh, tm) query min(sh, tm) min sh tm if dist < min_dist:
                min_dist = dist
     dist < min_dist dist min_dist min_dist = dist min_dist dist print(min_dist) print min_dist dist = min(sh - tm + (query - tm), sh - tm + (sh - query)) min(sh - tm + (query - tm), sh - tm + (sh - query)) dist min_dist = dist dist min_dist dist = query - min(sh, tm) query - min(sh, tm) dist temple = [] [] temple t = int(input()) int(input()) t ans = 0 0 ans shrine_list = [] [] shrine_list a, b, q = map(int, input().split()) map(int, input().split()) a b, q = map(int, input().split()) map(int, input().split()) b temple_index = bisect.bisect_left(temple, query) bisect.bisect_left(temple, query) temple_index query = int(input()) int(input()) query q = map(int, input().split()) map(int, input().split()) q shrine_index = bisect.bisect_left(shrine, query) bisect.bisect_left(shrine, query) shrine_index s = int(input()) int(input()) s min_dist = 10**12 10**12 min_dist temple_list = [] [] temple_list shrine = [] [] shrine dist = min(tm - sh + (query - sh), tm - sh + (tm - query)) min(tm - sh + (query - sh), tm - sh + (tm - query)) dist dist = max(sh, tm) - query max(sh, tm) - query dist
import bisect

a, b, q = map(int, input().split())
ans = 0

shrine = []
temple = []

for i in range(a):
    s = int(input())
    shrine.append(s)

for i in range(b):
    t = int(input())
    temple.append(t)


for j in range(q):
    shrine_list = []
    temple_list = []
    query = int(input())
    shrine_index = bisect.bisect_left(shrine, query)
    temple_index = bisect.bisect_left(temple, query)
    if shrine_index == 0:
        shrine_list.append(shrine[shrine_index])
    elif shrine_index == len(shrine):
        shrine_list.append(shrine[shrine_index-1])
    else:
        shrine_list.append(shrine[shrine_index])
        shrine_list.append(shrine[shrine_index-1])
    if temple_index == 0:
        temple_list.append(temple[temple_index])
    elif temple_index == len(temple):
        temple_list.append(temple[temple_index-1])
    else:
        temple_list.append(temple[temple_index])
        temple_list.append(temple[temple_index-1])
    min_dist = 10**12
    for sh in shrine_list:
        for tm in temple_list:
            if sh < query < tm:
                dist = min(tm - sh + (query - sh), tm - sh + (tm - query))
            elif tm < query < sh:
                dist = min(sh - tm + (query - tm), sh - tm + (sh - query))
            elif min(query, sh, tm) == query:
                dist = max(sh, tm) - query
            elif max(query, sh, tm) == query:
                dist = query - min(sh, tm)
            if dist < min_dist:
                min_dist = dist
    print(min_dist)

