public static void main ( String [ ] args ) {
  Scanner sc = new Scanner ( System . in ) ;
  int a = sc . nextInt ( ) , b = sc . nextInt ( ) , q = sc . nextInt ( ) ;
  TreeSet < Long > t = new TreeSet < Long > ( ) , s = new TreeSet < Long > ( ) ;
  for ( int i = 0 ;
  i < a ;
  i ++ ) s . add ( sc . nextLong ( ) ) ;
  for ( int i = 0 ;
  i < b ;
  i ++ ) t . add ( sc . nextLong ( ) ) ;
  for ( int i = 0 ;
  i < q ;
  i ++ ) {
    long pos = sc . nextLong ( ) ;
    Long tl = t . floor ( pos ) , tr = t . ceiling ( pos ) , sl = s . floor ( pos ) , sr = s . ceiling ( pos ) ;
    if ( tl == null ) tl = - 1L << 60 ;
    if ( tr == null ) tr = 1L << 60 ;
    if ( sl == null ) sl = - 1L << 60 ;
    if ( sr == null ) sr = 1L << 60 ;
    Long min = 1L << 60 ;
    min = Math . min ( Math . max ( pos - tl , pos - sl ) , Math . max ( tr - pos , sr - pos ) ) ;
    min = Math . min ( min , ( pos - tl ) + ( sr - pos ) + Math . min ( ( pos - tl ) , ( sr - pos ) ) ) ;
    min = Math . min ( min , ( tr - pos ) + ( pos - sl ) + Math . min ( ( tr - pos ) , ( pos - sl ) ) ) ;
    System . out . println ( min ) ;
  }
}

public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int a = sc . nextInt ( ) , b = sc . nextInt ( ) , q = sc . nextInt ( ) ; TreeSet < Long > t = new TreeSet < Long > ( ) , s = new TreeSet < Long > ( ) ; for ( int i = 0 ; i < a ; i ++ ) s . add ( sc . nextLong ( ) ) ; for ( int i = 0 ; i < b ; i ++ ) t . add ( sc . nextLong ( ) ) ; for ( int i = 0 ; i < q ; i ++ ) { long pos = sc . nextLong ( ) ; Long tl = t . floor ( pos ) , tr = t . ceiling ( pos ) , sl = s . floor ( pos ) , sr = s . ceiling ( pos ) ; if ( tl == null ) tl = - 1L << 60 ; if ( tr == null ) tr = 1L << 60 ; if ( sl == null ) sl = - 1L << 60 ; if ( sr == null ) sr = 1L << 60 ; Long min = 1L << 60 ; min = Math . min ( Math . max ( pos - tl , pos - sl ) , Math . max ( tr - pos , sr - pos ) ) ; min = Math . min ( min , ( pos - tl ) + ( sr - pos ) + Math . min ( ( pos - tl ) , ( sr - pos ) ) ) ; min = Math . min ( min , ( tr - pos ) + ( pos - sl ) + Math . min ( ( tr - pos ) , ( pos - sl ) ) ) ; System . out . println ( min ) ; } }
(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: (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))) declarator: (variable_declarator name: (identifier) value: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list))) declarator: (variable_declarator name: (identifier) value: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list)))) (local_variable_declaration type: (generic_type (type_identifier) (type_arguments (type_identifier))) declarator: (variable_declarator name: (identifier) value: (object_creation_expression type: (generic_type (type_identifier) (type_arguments (type_identifier))) arguments: (argument_list))) declarator: (variable_declarator name: (identifier) value: (object_creation_expression type: (generic_type (type_identifier) (type_arguments (type_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: (expression_statement (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (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: (expression_statement (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (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: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list)))) (local_variable_declaration type: (type_identifier) declarator: (variable_declarator name: (identifier) value: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (identifier)))) declarator: (variable_declarator name: (identifier) value: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (identifier)))) declarator: (variable_declarator name: (identifier) value: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (identifier)))) declarator: (variable_declarator name: (identifier) value: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (identifier))))) (if_statement condition: (parenthesized_expression (binary_expression left: (identifier) right: (null_literal))) consequence: (expression_statement (assignment_expression left: (identifier) right: (binary_expression left: (unary_expression operand: (decimal_integer_literal)) right: (decimal_integer_literal))))) (if_statement condition: (parenthesized_expression (binary_expression left: (identifier) right: (null_literal))) consequence: (expression_statement (assignment_expression left: (identifier) right: (binary_expression left: (decimal_integer_literal) right: (decimal_integer_literal))))) (if_statement condition: (parenthesized_expression (binary_expression left: (identifier) right: (null_literal))) consequence: (expression_statement (assignment_expression left: (identifier) right: (binary_expression left: (unary_expression operand: (decimal_integer_literal)) right: (decimal_integer_literal))))) (if_statement condition: (parenthesized_expression (binary_expression left: (identifier) right: (null_literal))) consequence: (expression_statement (assignment_expression left: (identifier) right: (binary_expression left: (decimal_integer_literal) right: (decimal_integer_literal))))) (local_variable_declaration type: (type_identifier) declarator: (variable_declarator name: (identifier) value: (binary_expression left: (decimal_integer_literal) right: (decimal_integer_literal)))) (expression_statement (assignment_expression left: (identifier) right: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (binary_expression left: (identifier) right: (identifier)) (binary_expression left: (identifier) right: (identifier)))) (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (binary_expression left: (identifier) right: (identifier)) (binary_expression left: (identifier) right: (identifier)))))))) (expression_statement (assignment_expression left: (identifier) right: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (identifier) (binary_expression left: (binary_expression left: (parenthesized_expression (binary_expression left: (identifier) right: (identifier))) right: (parenthesized_expression (binary_expression left: (identifier) right: (identifier)))) right: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (parenthesized_expression (binary_expression left: (identifier) right: (identifier))) (parenthesized_expression (binary_expression left: (identifier) right: (identifier)))))))))) (expression_statement (assignment_expression left: (identifier) right: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (identifier) (binary_expression left: (binary_expression left: (parenthesized_expression (binary_expression left: (identifier) right: (identifier))) right: (parenthesized_expression (binary_expression left: (identifier) right: (identifier)))) right: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (parenthesized_expression (binary_expression left: (identifier) right: (identifier))) (parenthesized_expression (binary_expression left: (identifier) right: (identifier)))))))))) (expression_statement (method_invocation object: (field_access object: (identifier) field: (identifier)) name: (identifier) arguments: (argument_list (identifier))))))))