def halfsplitsearch(list,start,end,minmax):
    if minmax=='min':
        while end-start>1:
            test=(end+start)//2
            if condition(list[test][0]):
                end=test
            else:
                start=test
        if condition(list[start][0]):
            return start
        else:
            return end
    else:
        while end-start>1:
            test=(end+start)//2
            if condition(list[test][0]):
                start=test
            else:
                end=test
        if condition(list[end][0]):
            return end
        else:
            return start

import sys

input=sys.stdin.readline

A,B,Q=map(int,input().split())
s=[[] for i in range(0,A)]
for i in range(0,A):
    y=int(input())
    s[i]=[y,'s',i]
t=[[] for i in range(0,B)]
for i in range(0,B):
    y=int(input())
    t[i]=[y,'t',i]
x=[0 for i in range(0,Q)]
for i in range(0,Q):
    x[i]=int(input())

list=s+t
list.sort()
s.sort()
t.sort()

sans=[0 for i in range(0,A)]
for i in range(0,A):
    ans=0
    def condition(num):
        return num<s[i][0]
    ans=halfsplitsearch(t,0,len(t)-1,'max')
    if ans!=B-1:
        sans[i]=min(abs(s[i][0]-t[ans][0]),abs(s[i][0]-t[ans+1][0]))
    else:
        sans[i]=abs(s[i][0]-t[ans][0])

tans=[0 for i in range(0,B)]
for i in range(0,B):
    ans=0
    def condition(num):
        return num<t[i][0]
    ans=halfsplitsearch(s,0,len(s)-1,'max')
    if ans!=A-1:
        tans[i]=min(abs(t[i][0]-s[ans][0]),abs(t[i][0]-s[ans+1][0]))
    else:
        tans[i]=abs(t[i][0]-s[ans][0])


for i in range(0,Q):
    a=0
    b=0
    test1=10**100
    test2=10**100
    def condition(num):
        return num<x[i]
    a=halfsplitsearch(list,0,len(list)-1,'max')
    if list[a][1]=='s':
        test1=abs(x[i]-list[a][0])+sans[list[a][2]]
    else:
        test1=abs(x[i]-list[a][0])+tans[list[a][2]]
    if a!=len(list)-1:
        if list[a+1][1]=='s':
            test2=abs(x[i]-list[a+1][0])+sans[list[a+1][2]]
        else:
            test2=abs(x[i]-list[a+1][0])+tans[list[a+1][2]]
    print(min(test1,test2)) def halfsplitsearch(list,start,end,minmax):
    if minmax=='min':
        while end-start>1:
            test=(end+start)//2
            if condition(list[test][0]):
                end=test
            else:
                start=test
        if condition(list[start][0]):
            return start
        else:
            return end
    else:
        while end-start>1:
            test=(end+start)//2
            if condition(list[test][0]):
                start=test
            else:
                end=test
        if condition(list[end][0]):
            return end
        else:
            return start halfsplitsearch if minmax=='min':
        while end-start>1:
            test=(end+start)//2
            if condition(list[test][0]):
                end=test
            else:
                start=test
        if condition(list[start][0]):
            return start
        else:
            return end
    else:
        while end-start>1:
            test=(end+start)//2
            if condition(list[test][0]):
                start=test
            else:
                end=test
        if condition(list[end][0]):
            return end
        else:
            return start minmax=='min' minmax 'min' while end-start>1:
            test=(end+start)//2
            if condition(list[test][0]):
                end=test
            else:
                start=test
         end-start>1 end-start end start 1 test=(end+start)//2 test (end+start)//2 end+start end start 2 if condition(list[test][0]):
                end=test
            else:
                start=test
         condition(list[test][0]) condition list[test][0] [test] list test 0 end=test end test start=test start test if condition(list[start][0]):
            return start
        else:
            return end
     condition(list[start][0]) condition list[start][0] [start] list start 0 return start start return end end while end-start>1:
            test=(end+start)//2
            if condition(list[test][0]):
                start=test
            else:
                end=test
         end-start>1 end-start end start 1 test=(end+start)//2 test (end+start)//2 end+start end start 2 if condition(list[test][0]):
                start=test
            else:
                end=test
         condition(list[test][0]) condition list[test][0] [test] list test 0 start=test start test end=test end test if condition(list[end][0]):
            return end
        else:
            return start condition(list[end][0]) condition list[end][0] [end] list end 0 return end end return start start list list start start end end minmax minmax import sys sys input=sys.stdin.readline input sys.stdin.readline sys.stdin sys stdin readline A,B,Q=map(int,input().split()) A map(int,input().split()) map int input().split() ().split () input split B Q [] for i in range(0,A) for i in range(0,A) i range(0,A) range 0 A for i in range(0,A) [] s=[[] for i in range(0,A)] s [[] for i in range(0,A)] for i in range(0,A):
    y=int(input())
    s[i]=[y,'s',i] i range(0,A) range 0 A y=int(input()) y int(input()) int input() input s[i]=[y,'s',i] s[i] s i [y,'s',i] y 's' i [] for i in range(0,B) for i in range(0,B) i range(0,B) range 0 B for i in range(0,B) [] t=[[] for i in range(0,B)] t [[] for i in range(0,B)] for i in range(0,B):
    y=int(input())
    t[i]=[y,'t',i] i range(0,B) range 0 B y=int(input()) y int(input()) int input() input t[i]=[y,'t',i] t[i] t i [y,'t',i] y 't' i 0 for i in range(0,Q) for i in range(0,Q) i range(0,Q) range 0 Q for i in range(0,Q) 0 x=[0 for i in range(0,Q)] x [0 for i in range(0,Q)] for i in range(0,Q):
    x[i]=int(input()) i range(0,Q) range 0 Q x[i]=int(input()) x[i] x i int(input()) int input() input list=s+t list s+t s t list.sort() list.sort list sort s.sort() s.sort s sort t.sort() t.sort t sort 0 for i in range(0,A) for i in range(0,A) i range(0,A) range 0 A for i in range(0,A) 0 sans=[0 for i in range(0,A)] sans [0 for i in range(0,A)] for i in range(0,A):
    ans=0
    def condition(num):
        return num<s[i][0]
    ans=halfsplitsearch(t,0,len(t)-1,'max')
    if ans!=B-1:
        sans[i]=min(abs(s[i][0]-t[ans][0]),abs(s[i][0]-t[ans+1][0]))
    else:
        sans[i]=abs(s[i][0]-t[ans][0]) i range(0,A) range 0 A ans=0 ans 0 def condition(num):
        return num<s[i][0]
     condition return num<s[i][0] num<s[i][0] num s[i][0] [i] s i 0 num num ans=halfsplitsearch(t,0,len(t)-1,'max') ans halfsplitsearch(t,0,len(t)-1,'max') halfsplitsearch t 0 len(t)-1 len(t) len t 1 'max' if ans!=B-1:
        sans[i]=min(abs(s[i][0]-t[ans][0]),abs(s[i][0]-t[ans+1][0]))
    else:
        sans[i]=abs(s[i][0]-t[ans][0]) ans!=B-1 ans B-1 B 1 sans[i]=min(abs(s[i][0]-t[ans][0]),abs(s[i][0]-t[ans+1][0])) sans[i] sans i min(abs(s[i][0]-t[ans][0]),abs(s[i][0]-t[ans+1][0])) min abs(s[i][0]-t[ans][0]) abs s[i][0]-t[ans][0] s[i][0] [i] s i 0 t[ans][0] [ans] t ans 0 abs(s[i][0]-t[ans+1][0]) abs s[i][0]-t[ans+1][0] s[i][0] [i] s i 0 t[ans+1][0] [ans+1] t ans+1 ans 1 0 sans[i]=abs(s[i][0]-t[ans][0]) sans[i] sans i abs(s[i][0]-t[ans][0]) abs s[i][0]-t[ans][0] s[i][0] [i] s i 0 t[ans][0] [ans] t ans 0 0 for i in range(0,B) for i in range(0,B) i range(0,B) range 0 B for i in range(0,B) 0 tans=[0 for i in range(0,B)] tans [0 for i in range(0,B)] for i in range(0,B):
    ans=0
    def condition(num):
        return num<t[i][0]
    ans=halfsplitsearch(s,0,len(s)-1,'max')
    if ans!=A-1:
        tans[i]=min(abs(t[i][0]-s[ans][0]),abs(t[i][0]-s[ans+1][0]))
    else:
        tans[i]=abs(t[i][0]-s[ans][0]) i range(0,B) range 0 B ans=0 ans 0 def condition(num):
        return num<t[i][0]
     condition return num<t[i][0] num<t[i][0] num t[i][0] [i] t i 0 num num ans=halfsplitsearch(s,0,len(s)-1,'max') ans halfsplitsearch(s,0,len(s)-1,'max') halfsplitsearch s 0 len(s)-1 len(s) len s 1 'max' if ans!=A-1:
        tans[i]=min(abs(t[i][0]-s[ans][0]),abs(t[i][0]-s[ans+1][0]))
    else:
        tans[i]=abs(t[i][0]-s[ans][0]) ans!=A-1 ans A-1 A 1 tans[i]=min(abs(t[i][0]-s[ans][0]),abs(t[i][0]-s[ans+1][0])) tans[i] tans i min(abs(t[i][0]-s[ans][0]),abs(t[i][0]-s[ans+1][0])) min abs(t[i][0]-s[ans][0]) abs t[i][0]-s[ans][0] t[i][0] [i] t i 0 s[ans][0] [ans] s ans 0 abs(t[i][0]-s[ans+1][0]) abs t[i][0]-s[ans+1][0] t[i][0] [i] t i 0 s[ans+1][0] [ans+1] s ans+1 ans 1 0 tans[i]=abs(t[i][0]-s[ans][0]) tans[i] tans i abs(t[i][0]-s[ans][0]) abs t[i][0]-s[ans][0] t[i][0] [i] t i 0 s[ans][0] [ans] s ans 0 for i in range(0,Q):
    a=0
    b=0
    test1=10**100
    test2=10**100
    def condition(num):
        return num<x[i]
    a=halfsplitsearch(list,0,len(list)-1,'max')
    if list[a][1]=='s':
        test1=abs(x[i]-list[a][0])+sans[list[a][2]]
    else:
        test1=abs(x[i]-list[a][0])+tans[list[a][2]]
    if a!=len(list)-1:
        if list[a+1][1]=='s':
            test2=abs(x[i]-list[a+1][0])+sans[list[a+1][2]]
        else:
            test2=abs(x[i]-list[a+1][0])+tans[list[a+1][2]]
    print(min(test1,test2)) i range(0,Q) range 0 Q a=0 a 0 b=0 b 0 test1=10**100 test1 10**100 10 100 test2=10**100 test2 10**100 10 100 def condition(num):
        return num<x[i]
     condition return num<x[i] num<x[i] num x[i] x i num num a=halfsplitsearch(list,0,len(list)-1,'max') a halfsplitsearch(list,0,len(list)-1,'max') halfsplitsearch list 0 len(list)-1 len(list) len list 1 'max' if list[a][1]=='s':
        test1=abs(x[i]-list[a][0])+sans[list[a][2]]
    else:
        test1=abs(x[i]-list[a][0])+tans[list[a][2]]
     list[a][1]=='s' list[a][1] [a] list a 1 's' test1=abs(x[i]-list[a][0])+sans[list[a][2]] test1 abs(x[i]-list[a][0])+sans[list[a][2]] abs(x[i]-list[a][0]) abs x[i]-list[a][0] x[i] x i list[a][0] [a] list a 0 sans[list[a][2]] sans list[a][2] [a] list a 2 test1=abs(x[i]-list[a][0])+tans[list[a][2]] test1 abs(x[i]-list[a][0])+tans[list[a][2]] abs(x[i]-list[a][0]) abs x[i]-list[a][0] x[i] x i list[a][0] [a] list a 0 tans[list[a][2]] tans list[a][2] [a] list a 2 if a!=len(list)-1:
        if list[a+1][1]=='s':
            test2=abs(x[i]-list[a+1][0])+sans[list[a+1][2]]
        else:
            test2=abs(x[i]-list[a+1][0])+tans[list[a+1][2]]
     a!=len(list)-1 a len(list)-1 len(list) len list 1 if list[a+1][1]=='s':
            test2=abs(x[i]-list[a+1][0])+sans[list[a+1][2]]
        else:
            test2=abs(x[i]-list[a+1][0])+tans[list[a+1][2]]
     list[a+1][1]=='s' list[a+1][1] [a+1] list a+1 a 1 1 's' test2=abs(x[i]-list[a+1][0])+sans[list[a+1][2]] test2 abs(x[i]-list[a+1][0])+sans[list[a+1][2]] abs(x[i]-list[a+1][0]) abs x[i]-list[a+1][0] x[i] x i list[a+1][0] [a+1] list a+1 a 1 0 sans[list[a+1][2]] sans list[a+1][2] [a+1] list a+1 a 1 2 test2=abs(x[i]-list[a+1][0])+tans[list[a+1][2]] test2 abs(x[i]-list[a+1][0])+tans[list[a+1][2]] abs(x[i]-list[a+1][0]) abs x[i]-list[a+1][0] x[i] x i list[a+1][0] [a+1] list a+1 a 1 0 tans[list[a+1][2]] tans list[a+1][2] [a+1] list a+1 a 1 2 print(min(test1,test2)) print min(test1,test2) min test1 test2 Q=map(int,input().split()) map(int,input().split()) Q y=int(input()) int(input()) y list=s+t s+t list test2=abs(x[i]-list[a+1][0])+sans[list[a+1][2]] abs(x[i]-list[a+1][0])+sans[list[a+1][2]] test2 ans=halfsplitsearch(s,0,len(s)-1,'max') halfsplitsearch(s,0,len(s)-1,'max') ans test1=abs(x[i]-list[a][0])+sans[list[a][2]] abs(x[i]-list[a][0])+sans[list[a][2]] test1 test1=10**100 10**100 test1 def halfsplitsearch(list,start,end,minmax):
    if minmax=='min':
        while end-start>1:
            test=(end+start)//2
            if condition(list[test][0]):
                end=test
            else:
                start=test
        if condition(list[start][0]):
            return start
        else:
            return end
    else:
        while end-start>1:
            test=(end+start)//2
            if condition(list[test][0]):
                start=test
            else:
                end=test
        if condition(list[end][0]):
            return end
        else:
            return start def halfsplitsearch(list,start,end,minmax):
    if minmax=='min':
        while end-start>1:
            test=(end+start)//2
            if condition(list[test][0]):
                end=test
            else:
                start=test
        if condition(list[start][0]):
            return start
        else:
            return end
    else:
        while end-start>1:
            test=(end+start)//2
            if condition(list[test][0]):
                start=test
            else:
                end=test
        if condition(list[end][0]):
            return end
        else:
            return start halfsplitsearch b=0 0 b def condition(num):
        return num<x[i]
     def condition(num):
        return num<x[i]
     condition test2=10**100 10**100 test2 ans=0 0 ans tans=[0 for i in range(0,B)] [0 for i in range(0,B)] tans s=[[] for i in range(0,A)] [[] for i in range(0,A)] s t=[[] for i in range(0,B)] [[] for i in range(0,B)] t x=[0 for i in range(0,Q)] [0 for i in range(0,Q)] x def condition(num):
        return num<s[i][0]
     def condition(num):
        return num<s[i][0]
     condition input=sys.stdin.readline sys.stdin.readline input ans=halfsplitsearch(t,0,len(t)-1,'max') halfsplitsearch(t,0,len(t)-1,'max') ans test2=abs(x[i]-list[a+1][0])+tans[list[a+1][2]] abs(x[i]-list[a+1][0])+tans[list[a+1][2]] test2 a=0 0 a B,Q=map(int,input().split()) map(int,input().split()) B sans=[0 for i in range(0,A)] [0 for i in range(0,A)] sans A,B,Q=map(int,input().split()) map(int,input().split()) A ans=0 0 ans test1=abs(x[i]-list[a][0])+tans[list[a][2]] abs(x[i]-list[a][0])+tans[list[a][2]] test1 y=int(input()) int(input()) y a=halfsplitsearch(list,0,len(list)-1,'max') halfsplitsearch(list,0,len(list)-1,'max') a def condition(num):
        return num<t[i][0]
     def condition(num):
        return num<t[i][0]
     condition
def halfsplitsearch(list,start,end,minmax):
    if minmax=='min':
        while end-start>1:
            test=(end+start)//2
            if condition(list[test][0]):
                end=test
            else:
                start=test
        if condition(list[start][0]):
            return start
        else:
            return end
    else:
        while end-start>1:
            test=(end+start)//2
            if condition(list[test][0]):
                start=test
            else:
                end=test
        if condition(list[end][0]):
            return end
        else:
            return start

import sys

input=sys.stdin.readline

A,B,Q=map(int,input().split())
s=[[] for i in range(0,A)]
for i in range(0,A):
    y=int(input())
    s[i]=[y,'s',i]
t=[[] for i in range(0,B)]
for i in range(0,B):
    y=int(input())
    t[i]=[y,'t',i]
x=[0 for i in range(0,Q)]
for i in range(0,Q):
    x[i]=int(input())

list=s+t
list.sort()
s.sort()
t.sort()

sans=[0 for i in range(0,A)]
for i in range(0,A):
    ans=0
    def condition(num):
        return num<s[i][0]
    ans=halfsplitsearch(t,0,len(t)-1,'max')
    if ans!=B-1:
        sans[i]=min(abs(s[i][0]-t[ans][0]),abs(s[i][0]-t[ans+1][0]))
    else:
        sans[i]=abs(s[i][0]-t[ans][0])

tans=[0 for i in range(0,B)]
for i in range(0,B):
    ans=0
    def condition(num):
        return num<t[i][0]
    ans=halfsplitsearch(s,0,len(s)-1,'max')
    if ans!=A-1:
        tans[i]=min(abs(t[i][0]-s[ans][0]),abs(t[i][0]-s[ans+1][0]))
    else:
        tans[i]=abs(t[i][0]-s[ans][0])


for i in range(0,Q):
    a=0
    b=0
    test1=10**100
    test2=10**100
    def condition(num):
        return num<x[i]
    a=halfsplitsearch(list,0,len(list)-1,'max')
    if list[a][1]=='s':
        test1=abs(x[i]-list[a][0])+sans[list[a][2]]
    else:
        test1=abs(x[i]-list[a][0])+tans[list[a][2]]
    if a!=len(list)-1:
        if list[a+1][1]=='s':
            test2=abs(x[i]-list[a+1][0])+sans[list[a+1][2]]
        else:
            test2=abs(x[i]-list[a+1][0])+tans[list[a+1][2]]
    print(min(test1,test2))