

import bisect

def nearest(x, lst):
    p = bisect.bisect_left(lst, x)
    
    if p == 0:
        return lst[p], None
    if p == len(lst):
        return lst[p - 1], None
    if lst[p] == x:
        return lst[p], None
    return lst[p - 1], lst[p]
 

def submit():
    a, b, q = map(int, input().split())

    slist = [int(input()) for _ in range(a)]
    tlist = [int(input()) for _ in range(b)]
    qlist = [int(input()) for _ in range(q)]

    near_s = {s: nearest(s, tlist) for s in slist}
    near_t = {t: nearest(t, slist) for t in tlist}

    anss = []
    for q in qlist:
        ans = float('inf')
        # 一番近いs->tの順の場合
        n = nearest(q, slist)
        for e in n:
            if not e: 
                continue
            for ee in near_s[e]:
                if not ee:
                    continue
                if ans > abs(q - e) + abs(ee - e):
                    ans = abs(q - e) + abs(ee - e)                            
        # 一番近いt->sの順の場合
        n = nearest(q, tlist)
        for e in n:
            if not e:
                continue
            for ee in near_t[e]:
                if not ee:
                    continue
                if ans > abs(q - e) + abs(ee - e):
                    ans = abs(q - e) + abs(ee - e)
        anss.append(ans)

    for ans in anss:
        print(ans)


submit()
 import bisect bisect def nearest(x, lst):
    p = bisect.bisect_left(lst, x)
    
    if p == 0:
        return lst[p], None
    if p == len(lst):
        return lst[p - 1], None
    if lst[p] == x:
        return lst[p], None
    return lst[p - 1], lst[p]
  nearest p = bisect.bisect_left(lst, x) p bisect.bisect_left(lst, x) bisect.bisect_left bisect bisect_left lst x if p == 0:
        return lst[p], None
     p == 0 p 0 return lst[p], None return lst[p], None lst[p] lst p None if p == len(lst):
        return lst[p - 1], None
     p == len(lst) p len(lst) len lst return lst[p - 1], None return lst[p - 1], None lst[p - 1] lst p - 1 p 1 None if lst[p] == x:
        return lst[p], None
     lst[p] == x lst[p] lst p x return lst[p], None return lst[p], None lst[p] lst p None return lst[p - 1], lst[p] return lst[p - 1], lst[p] lst[p - 1] lst p - 1 p 1 lst[p] lst p x x lst lst def submit():
    a, b, q = map(int, input().split())

    slist = [int(input()) for _ in range(a)]
    tlist = [int(input()) for _ in range(b)]
    qlist = [int(input()) for _ in range(q)]

    near_s = {s: nearest(s, tlist) for s in slist}
    near_t = {t: nearest(t, slist) for t in tlist}

    anss = []
    for q in qlist:
        ans = float('inf')
        # 一番近いs->tの順の場合
        n = nearest(q, slist)
        for e in n:
            if not e: 
                continue
            for ee in near_s[e]:
                if not ee:
                    continue
                if ans > abs(q - e) + abs(ee - e):
                    ans = abs(q - e) + abs(ee - e)                            
        # 一番近いt->sの順の場合
        n = nearest(q, tlist)
        for e in n:
            if not e:
                continue
            for ee in near_t[e]:
                if not ee:
                    continue
                if ans > abs(q - e) + abs(ee - e):
                    ans = abs(q - e) + abs(ee - e)
        anss.append(ans)

    for ans in anss:
        print(ans) submit a, b, q = map(int, input().split()) a map(int, input().split()) map int input().split() ().split () input split b q int(input()) for _ in range(a) for _ in range(a) _ range(a) range a for _ in range(a) int(input()) int input() input slist = [int(input()) for _ in range(a)] slist [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 tlist = [int(input()) for _ in range(b)] tlist [int(input()) for _ in range(b)] int(input()) for _ in range(q) for _ in range(q) _ range(q) range q for _ in range(q) int(input()) int input() input qlist = [int(input()) for _ in range(q)] qlist [int(input()) for _ in range(q)] s: nearest(s, tlist) for s in slist for s in slist s slist for s in slist s nearest(s, tlist) nearest s tlist near_s = {s: nearest(s, tlist) for s in slist} near_s {s: nearest(s, tlist) for s in slist} t: nearest(t, slist) for t in tlist for t in tlist t tlist for t in tlist t nearest(t, slist) nearest t slist near_t = {t: nearest(t, slist) for t in tlist} near_t {t: nearest(t, slist) for t in tlist} anss = [] anss [] for q in qlist:
        ans = float('inf')
        # 一番近いs->tの順の場合
        n = nearest(q, slist)
        for e in n:
            if not e: 
                continue
            for ee in near_s[e]:
                if not ee:
                    continue
                if ans > abs(q - e) + abs(ee - e):
                    ans = abs(q - e) + abs(ee - e)                            
        # 一番近いt->sの順の場合
        n = nearest(q, tlist)
        for e in n:
            if not e:
                continue
            for ee in near_t[e]:
                if not ee:
                    continue
                if ans > abs(q - e) + abs(ee - e):
                    ans = abs(q - e) + abs(ee - e)
        anss.append(ans)

     q qlist ans = float('inf') ans float('inf') float 'inf' n = nearest(q, slist) n nearest(q, slist) nearest q slist for e in n:
            if not e: 
                continue
            for ee in near_s[e]:
                if not ee:
                    continue
                if ans > abs(q - e) + abs(ee - e):
                    ans = abs(q - e) + abs(ee - e)                            
        # 一番近いt->sの順の場合
         e n if not e: 
                continue
             not e e continue for ee in near_s[e]:
                if not ee:
                    continue
                if ans > abs(q - e) + abs(ee - e):
                    ans = abs(q - e) + abs(ee - e)                            
        # 一番近いt->sの順の場合
         ee near_s[e] near_s e if not ee:
                    continue
                 not ee ee continue if ans > abs(q - e) + abs(ee - e):
                    ans = abs(q - e) + abs(ee - e)                            
        # 一番近いt->sの順の場合
         ans > abs(q - e) + abs(ee - e) ans abs(q - e) + abs(ee - e) abs(q - e) abs q - e q e abs(ee - e) abs ee - e ee e ans = abs(q - e) + abs(ee - e) ans abs(q - e) + abs(ee - e) abs(q - e) abs q - e q e abs(ee - e) abs ee - e ee e n = nearest(q, tlist) n nearest(q, tlist) nearest q tlist for e in n:
            if not e:
                continue
            for ee in near_t[e]:
                if not ee:
                    continue
                if ans > abs(q - e) + abs(ee - e):
                    ans = abs(q - e) + abs(ee - e)
         e n if not e:
                continue
             not e e continue for ee in near_t[e]:
                if not ee:
                    continue
                if ans > abs(q - e) + abs(ee - e):
                    ans = abs(q - e) + abs(ee - e)
         ee near_t[e] near_t e if not ee:
                    continue
                 not ee ee continue if ans > abs(q - e) + abs(ee - e):
                    ans = abs(q - e) + abs(ee - e)
         ans > abs(q - e) + abs(ee - e) ans abs(q - e) + abs(ee - e) abs(q - e) abs q - e q e abs(ee - e) abs ee - e ee e ans = abs(q - e) + abs(ee - e) ans abs(q - e) + abs(ee - e) abs(q - e) abs q - e q e abs(ee - e) abs ee - e ee e anss.append(ans) anss.append anss append ans for ans in anss:
        print(ans) ans anss print(ans) print ans submit() submit def submit():
    a, b, q = map(int, input().split())

    slist = [int(input()) for _ in range(a)]
    tlist = [int(input()) for _ in range(b)]
    qlist = [int(input()) for _ in range(q)]

    near_s = {s: nearest(s, tlist) for s in slist}
    near_t = {t: nearest(t, slist) for t in tlist}

    anss = []
    for q in qlist:
        ans = float('inf')
        # 一番近いs->tの順の場合
        n = nearest(q, slist)
        for e in n:
            if not e: 
                continue
            for ee in near_s[e]:
                if not ee:
                    continue
                if ans > abs(q - e) + abs(ee - e):
                    ans = abs(q - e) + abs(ee - e)                            
        # 一番近いt->sの順の場合
        n = nearest(q, tlist)
        for e in n:
            if not e:
                continue
            for ee in near_t[e]:
                if not ee:
                    continue
                if ans > abs(q - e) + abs(ee - e):
                    ans = abs(q - e) + abs(ee - e)
        anss.append(ans)

    for ans in anss:
        print(ans) def submit():
    a, b, q = map(int, input().split())

    slist = [int(input()) for _ in range(a)]
    tlist = [int(input()) for _ in range(b)]
    qlist = [int(input()) for _ in range(q)]

    near_s = {s: nearest(s, tlist) for s in slist}
    near_t = {t: nearest(t, slist) for t in tlist}

    anss = []
    for q in qlist:
        ans = float('inf')
        # 一番近いs->tの順の場合
        n = nearest(q, slist)
        for e in n:
            if not e: 
                continue
            for ee in near_s[e]:
                if not ee:
                    continue
                if ans > abs(q - e) + abs(ee - e):
                    ans = abs(q - e) + abs(ee - e)                            
        # 一番近いt->sの順の場合
        n = nearest(q, tlist)
        for e in n:
            if not e:
                continue
            for ee in near_t[e]:
                if not ee:
                    continue
                if ans > abs(q - e) + abs(ee - e):
                    ans = abs(q - e) + abs(ee - e)
        anss.append(ans)

    for ans in anss:
        print(ans) submit def nearest(x, lst):
    p = bisect.bisect_left(lst, x)
    
    if p == 0:
        return lst[p], None
    if p == len(lst):
        return lst[p - 1], None
    if lst[p] == x:
        return lst[p], None
    return lst[p - 1], lst[p]
  def nearest(x, lst):
    p = bisect.bisect_left(lst, x)
    
    if p == 0:
        return lst[p], None
    if p == len(lst):
        return lst[p - 1], None
    if lst[p] == x:
        return lst[p], None
    return lst[p - 1], lst[p]
  nearest


import bisect

def nearest(x, lst):
    p = bisect.bisect_left(lst, x)
    
    if p == 0:
        return lst[p], None
    if p == len(lst):
        return lst[p - 1], None
    if lst[p] == x:
        return lst[p], None
    return lst[p - 1], lst[p]
 

def submit():
    a, b, q = map(int, input().split())

    slist = [int(input()) for _ in range(a)]
    tlist = [int(input()) for _ in range(b)]
    qlist = [int(input()) for _ in range(q)]

    near_s = {s: nearest(s, tlist) for s in slist}
    near_t = {t: nearest(t, slist) for t in tlist}

    anss = []
    for q in qlist:
        ans = float('inf')
        # 一番近いs->tの順の場合
        n = nearest(q, slist)
        for e in n:
            if not e: 
                continue
            for ee in near_s[e]:
                if not ee:
                    continue
                if ans > abs(q - e) + abs(ee - e):
                    ans = abs(q - e) + abs(ee - e)                            
        # 一番近いt->sの順の場合
        n = nearest(q, tlist)
        for e in n:
            if not e:
                continue
            for ee in near_t[e]:
                if not ee:
                    continue
                if ans > abs(q - e) + abs(ee - e):
                    ans = abs(q - e) + abs(ee - e)
        anss.append(ans)

    for ans in anss:
        print(ans)


submit()

