public static void main ( String args [ ] ) throws IOException {
  BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ;
  StringBuilder sb = new StringBuilder ( ) ;
  String [ ] sr = br . readLine ( ) . split ( "" ) ;
  String [ ] pr = br . readLine ( ) . split ( "" ) ;
  Integer [ ] arr = new Integer [ sr . length ] ;
  Integer [ ] arr1 = new Integer [ pr . length ] ;
  for ( int i = 0 ;
  i < sr . length ;
  i ++ ) arr [ i ] = Integer . parseInt ( sr [ i ] ) ;
  for ( int i = 0 ;
  i < pr . length ;
  i ++ ) arr1 [ i ] = Integer . parseInt ( pr [ i ] ) ;
  Arrays . sort ( arr1 , Collections . reverseOrder ( ) ) ;
  int l = 0 , m = 0 ;
  for ( ;
  l < sr . length ;
  l ++ ) {
    for ( ;
    m < pr . length ;
    m ++ ) {
      if ( arr1 [ m ] > arr [ l ] ) {
        arr [ l ] = arr1 [ m ] ;
        m ++ ;
        break ;
      }
      else {
        break ;
      }
    }
  }
  for ( int i = 0 ;
  i < sr . length ;
  i ++ ) System . out . print ( arr [ i ] ) ;
}

public static void main ( String args [ ] ) throws IOException { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; StringBuilder sb = new StringBuilder ( ) ; String [ ] sr = br . readLine ( ) . split ( " " ) ; String [ ] pr = br . readLine ( ) . split ( " " ) ; Integer [ ] arr = new Integer [ sr . length ] ; Integer [ ] arr1 = new Integer [ pr . length ] ; for ( int i = 0 ; i < sr . length ; i ++ ) arr [ i ] = Integer . parseInt ( sr [ i ] ) ; for ( int i = 0 ; i < pr . length ; i ++ ) arr1 [ i ] = Integer . parseInt ( pr [ i ] ) ; Arrays . sort ( arr1 , Collections . reverseOrder ( ) ) ; int l = 0 , m = 0 ; for ( ; l < sr . length ; l ++ ) { for ( ; m < pr . length ; m ++ ) { if ( arr1 [ m ] > arr [ l ] ) { arr [ l ] = arr1 [ m ] ; m ++ ; break ; } else { break ; } } } for ( int i = 0 ; i < sr . length ; i ++ ) System . out . print ( arr [ i ] ) ; }
(method_declaration (modifiers) type: (void_type) name: (identifier) parameters: (formal_parameters (formal_parameter type: (type_identifier) name: (identifier) dimensions: (dimensions))) (throws (type_identifier)) body: (block (local_variable_declaration type: (type_identifier) declarator: (variable_declarator name: (identifier) value: (object_creation_expression type: (type_identifier) arguments: (argument_list (object_creation_expression type: (type_identifier) arguments: (argument_list (field_access object: (identifier) field: (identifier)))))))) (local_variable_declaration type: (type_identifier) declarator: (variable_declarator name: (identifier) value: (object_creation_expression type: (type_identifier) arguments: (argument_list)))) (local_variable_declaration type: (array_type element: (type_identifier) dimensions: (dimensions)) declarator: (variable_declarator name: (identifier) value: (method_invocation object: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list)) name: (identifier) arguments: (argument_list (string_literal))))) (local_variable_declaration type: (array_type element: (type_identifier) dimensions: (dimensions)) declarator: (variable_declarator name: (identifier) value: (method_invocation object: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list)) name: (identifier) arguments: (argument_list (string_literal))))) (local_variable_declaration type: (array_type element: (type_identifier) dimensions: (dimensions)) declarator: (variable_declarator name: (identifier) value: (array_creation_expression type: (type_identifier) dimensions: (dimensions_expr (field_access object: (identifier) field: (identifier)))))) (local_variable_declaration type: (array_type element: (type_identifier) dimensions: (dimensions)) declarator: (variable_declarator name: (identifier) value: (array_creation_expression type: (type_identifier) dimensions: (dimensions_expr (field_access object: (identifier) field: (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: (field_access object: (identifier) field: (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 (array_access array: (identifier) index: (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: (field_access object: (identifier) field: (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 (array_access array: (identifier) index: (identifier))))))) (expression_statement (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (identifier) (method_invocation object: (identifier) name: (identifier) arguments: (argument_list))))) (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) value: (decimal_integer_literal)) declarator: (variable_declarator name: (identifier) value: (decimal_integer_literal))) (for_statement condition: (binary_expression left: (identifier) right: (field_access object: (identifier) field: (identifier))) update: (update_expression (identifier)) body: (block (for_statement condition: (binary_expression left: (identifier) right: (field_access object: (identifier) field: (identifier))) update: (update_expression (identifier)) body: (block (if_statement condition: (parenthesized_expression (binary_expression left: (array_access array: (identifier) index: (identifier)) right: (array_access array: (identifier) index: (identifier)))) consequence: (block (expression_statement (assignment_expression left: (array_access array: (identifier) index: (identifier)) right: (array_access array: (identifier) index: (identifier)))) (expression_statement (update_expression (identifier))) (break_statement)) alternative: (block (break_statement))))))) (for_statement init: (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) value: (decimal_integer_literal))) condition: (binary_expression left: (identifier) right: (field_access object: (identifier) field: (identifier))) update: (update_expression (identifier)) body: (expression_statement (method_invocation object: (field_access object: (identifier) field: (identifier)) name: (identifier) arguments: (argument_list (array_access array: (identifier) index: (identifier))))))))