public static void main ( String [ ] args ) {
  long inf = ( long ) Math . pow ( 10 , 11 ) ;
  Scanner sc = new Scanner ( System . in ) ;
  int A = sc . nextInt ( ) ;
  int B = sc . nextInt ( ) ;
  int Q = sc . nextInt ( ) ;
  long [ ] s = new long [ A + 2 ] ;
  s [ 0 ] = - inf ;
  s [ A + 1 ] = inf ;
  for ( int i = 1 ;
  i < A + 1 ;
  i ++ ) s [ i ] = sc . nextLong ( ) ;
  long [ ] t = new long [ B + 2 ] ;
  t [ 0 ] = - inf ;
  t [ B + 1 ] = inf ;
  for ( int i = 1 ;
  i < B + 1 ;
  i ++ ) t [ i ] = sc . nextLong ( ) ;
  long [ ] x = new long [ Q ] ;
  for ( int i = 0 ;
  i < Q ;
  i ++ ) x [ i ] = sc . nextLong ( ) ;
  for ( int i = 0 ;
  i < Q ;
  i ++ ) {
    int b = Math . abs ( Arrays . binarySearch ( s , x [ i ] ) ) - 1 ;
    int d = Math . abs ( Arrays . binarySearch ( t , x [ i ] ) ) - 1 ;
    long res = inf ;
    for ( int j = b - 1 ;
    j <= b ;
    j ++ ) {
      for ( int k = d - 1 ;
      k <= d ;
      k ++ ) {
        long d1 = Math . abs ( s [ j ] - x [ i ] ) + Math . abs ( s [ j ] - t [ k ] ) ;
        long d2 = Math . abs ( t [ k ] - x [ i ] ) + Math . abs ( s [ j ] - t [ k ] ) ;
        res = Math . min ( res , Math . min ( d1 , d2 ) ) ;
      }
    }
    System . out . println ( res ) ;
  }
}

public static void main ( String [ ] args ) { long inf = ( long ) Math . pow ( 10 , 11 ) ; Scanner sc = new Scanner ( System . in ) ; int A = sc . nextInt ( ) ; int B = sc . nextInt ( ) ; int Q = sc . nextInt ( ) ; long [ ] s = new long [ A + 2 ] ; s [ 0 ] = - inf ; s [ A + 1 ] = inf ; for ( int i = 1 ; i < A + 1 ; i ++ ) s [ i ] = sc . nextLong ( ) ; long [ ] t = new long [ B + 2 ] ; t [ 0 ] = - inf ; t [ B + 1 ] = inf ; for ( int i = 1 ; i < B + 1 ; i ++ ) t [ i ] = sc . nextLong ( ) ; long [ ] x = new long [ Q ] ; for ( int i = 0 ; i < Q ; i ++ ) x [ i ] = sc . nextLong ( ) ; for ( int i = 0 ; i < Q ; i ++ ) { int b = Math . abs ( Arrays . binarySearch ( s , x [ i ] ) ) - 1 ; int d = Math . abs ( Arrays . binarySearch ( t , x [ i ] ) ) - 1 ; long res = inf ; for ( int j = b - 1 ; j <= b ; j ++ ) { for ( int k = d - 1 ; k <= d ; k ++ ) { long d1 = Math . abs ( s [ j ] - x [ i ] ) + Math . abs ( s [ j ] - t [ k ] ) ; long d2 = Math . abs ( t [ k ] - x [ i ] ) + Math . abs ( s [ j ] - t [ k ] ) ; res = Math . min ( res , Math . min ( d1 , d2 ) ) ; } } System . out . println ( res ) ; } }
(method_declaration (modifiers) type: (void_type) name: (identifier) parameters: (formal_parameters (formal_parameter type: (array_type element: (type_identifier) dimensions: (dimensions)) name: (identifier))) body: (block (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) value: (cast_expression type: (integral_type) value: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (decimal_integer_literal) (decimal_integer_literal)))))) (local_variable_declaration type: (type_identifier) declarator: (variable_declarator name: (identifier) value: (object_creation_expression type: (type_identifier) arguments: (argument_list (field_access object: (identifier) field: (identifier)))))) (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) value: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list)))) (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) value: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list)))) (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) value: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list)))) (local_variable_declaration type: (array_type element: (integral_type) dimensions: (dimensions)) declarator: (variable_declarator name: (identifier) value: (array_creation_expression type: (integral_type) dimensions: (dimensions_expr (binary_expression left: (identifier) right: (decimal_integer_literal)))))) (expression_statement (assignment_expression left: (array_access array: (identifier) index: (decimal_integer_literal)) right: (unary_expression operand: (identifier)))) (expression_statement (assignment_expression left: (array_access array: (identifier) index: (binary_expression left: (identifier) right: (decimal_integer_literal))) right: (identifier))) (for_statement init: (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) value: (decimal_integer_literal))) condition: (binary_expression left: (identifier) right: (binary_expression left: (identifier) right: (decimal_integer_literal))) update: (update_expression (identifier)) body: (expression_statement (assignment_expression left: (array_access array: (identifier) index: (identifier)) right: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list))))) (local_variable_declaration type: (array_type element: (integral_type) dimensions: (dimensions)) declarator: (variable_declarator name: (identifier) value: (array_creation_expression type: (integral_type) dimensions: (dimensions_expr (binary_expression left: (identifier) right: (decimal_integer_literal)))))) (expression_statement (assignment_expression left: (array_access array: (identifier) index: (decimal_integer_literal)) right: (unary_expression operand: (identifier)))) (expression_statement (assignment_expression left: (array_access array: (identifier) index: (binary_expression left: (identifier) right: (decimal_integer_literal))) right: (identifier))) (for_statement init: (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) value: (decimal_integer_literal))) condition: (binary_expression left: (identifier) right: (binary_expression left: (identifier) right: (decimal_integer_literal))) update: (update_expression (identifier)) body: (expression_statement (assignment_expression left: (array_access array: (identifier) index: (identifier)) right: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list))))) (local_variable_declaration type: (array_type element: (integral_type) dimensions: (dimensions)) declarator: (variable_declarator name: (identifier) value: (array_creation_expression type: (integral_type) dimensions: (dimensions_expr (identifier))))) (for_statement init: (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) value: (decimal_integer_literal))) condition: (binary_expression left: (identifier) right: (identifier)) update: (update_expression (identifier)) body: (expression_statement (assignment_expression left: (array_access array: (identifier) index: (identifier)) right: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list))))) (for_statement init: (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) value: (decimal_integer_literal))) condition: (binary_expression left: (identifier) right: (identifier)) update: (update_expression (identifier)) body: (block (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) value: (binary_expression left: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (identifier) (array_access array: (identifier) index: (identifier)))))) right: (decimal_integer_literal)))) (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) value: (binary_expression left: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (identifier) (array_access array: (identifier) index: (identifier)))))) right: (decimal_integer_literal)))) (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) value: (identifier))) (for_statement init: (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) value: (binary_expression left: (identifier) right: (decimal_integer_literal)))) condition: (binary_expression left: (identifier) right: (identifier)) update: (update_expression (identifier)) body: (block (for_statement init: (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) value: (binary_expression left: (identifier) right: (decimal_integer_literal)))) condition: (binary_expression left: (identifier) right: (identifier)) update: (update_expression (identifier)) body: (block (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) value: (binary_expression left: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (binary_expression left: (array_access array: (identifier) index: (identifier)) right: (array_access array: (identifier) index: (identifier))))) right: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (binary_expression left: (array_access array: (identifier) index: (identifier)) right: (array_access array: (identifier) index: (identifier)))))))) (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) value: (binary_expression left: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (binary_expression left: (array_access array: (identifier) index: (identifier)) right: (array_access array: (identifier) index: (identifier))))) right: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (binary_expression left: (array_access array: (identifier) index: (identifier)) right: (array_access array: (identifier) index: (identifier)))))))) (expression_statement (assignment_expression left: (identifier) right: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (identifier) (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (identifier) (identifier))))))))))) (expression_statement (method_invocation object: (field_access object: (identifier) field: (identifier)) name: (identifier) arguments: (argument_list (identifier))))))))