static void Find_Sequence ( int [ ] arr , int n ) {
  Vector < Integer > inc_arr = new Vector < > ( ) , dec_arr = new Vector < > ( ) ;
  int flag = 0 ;
  long inc = - 1 , dec = ( long ) 1e7 ;
  for ( int i = 0 ;
  i < n ;
  i ++ ) {
    if ( inc < arr [ i ] && arr [ i ] < dec ) {
      if ( arr [ i ] < arr [ i + 1 ] ) {
        inc = arr [ i ] ;
        inc_arr . add ( arr [ i ] ) ;
      }
      else {
        dec = arr [ i ] ;
        dec_arr . add ( arr [ i ] ) ;
      }
    }
    else if ( inc < arr [ i ] ) {
      inc = arr [ i ] ;
      inc_arr . add ( arr [ i ] ) ;
    }
    else if ( dec > arr [ i ] ) {
      dec = arr [ i ] ;
      dec_arr . add ( arr [ i ] ) ;
    }
    else {
      System . out . println ( - 1 ) ;
      flag = 1 ;
      break ;
    }
  }
  if ( flag == 0 ) {
    for ( int i : inc_arr ) System . out . print ( i + " " ) ;
    System . out . println ( ) ;
    for ( int i : dec_arr ) System . out . print ( i + " " ) ;
    System . out . println ( ) ;
  }
}

static void Find_Sequence ( int [ ] arr , int n ) { Vector < Integer > inc_arr = new Vector < > ( ) , dec_arr = new Vector < > ( ) ; int flag = 0 ; long inc = - 1 , dec = ( long ) 1e7 ; for ( int i = 0 ; i < n ; i ++ ) { if ( inc < arr [ i ] && arr [ i ] < dec ) { if ( arr [ i ] < arr [ i + 1 ] ) { inc = arr [ i ] ; inc_arr . add ( arr [ i ] ) ; } else { dec = arr [ i ] ; dec_arr . add ( arr [ i ] ) ; } } else if ( inc < arr [ i ] ) { inc = arr [ i ] ; inc_arr . add ( arr [ i ] ) ; } else if ( dec > arr [ i ] ) { dec = arr [ i ] ; dec_arr . add ( arr [ i ] ) ; } else { System . out . println ( - 1 ) ; flag = 1 ; break ; } } if ( flag == 0 ) { for ( int i : inc_arr ) System . out . print ( i + " ▁ " ) ; System . out . println ( ) ; for ( int i : dec_arr ) System . out . print ( i + " ▁ " ) ; System . out . println ( ) ; } }
(method_declaration (modifiers) type: (void_type) name: (identifier) parameters: (formal_parameters (formal_parameter type: (array_type element: (integral_type) dimensions: (dimensions)) name: (identifier)) (formal_parameter type: (integral_type) name: (identifier))) body: (block (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)) arguments: (argument_list))) declarator: (variable_declarator name: (identifier) value: (object_creation_expression type: (generic_type (type_identifier) (type_arguments)) arguments: (argument_list)))) (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) value: (decimal_integer_literal))) (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) value: (unary_expression operand: (decimal_integer_literal))) declarator: (variable_declarator name: (identifier) value: (cast_expression type: (integral_type) value: (decimal_floating_point_literal)))) (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 (if_statement condition: (parenthesized_expression (binary_expression left: (binary_expression left: (identifier) right: (array_access array: (identifier) index: (identifier))) right: (binary_expression left: (array_access array: (identifier) index: (identifier)) right: (identifier)))) consequence: (block (if_statement condition: (parenthesized_expression (binary_expression left: (array_access array: (identifier) index: (identifier)) right: (array_access array: (identifier) index: (binary_expression left: (identifier) right: (decimal_integer_literal))))) consequence: (block (expression_statement (assignment_expression left: (identifier) right: (array_access array: (identifier) index: (identifier)))) (expression_statement (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (array_access array: (identifier) index: (identifier)))))) alternative: (block (expression_statement (assignment_expression left: (identifier) right: (array_access array: (identifier) index: (identifier)))) (expression_statement (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (array_access array: (identifier) index: (identifier)))))))) alternative: (if_statement condition: (parenthesized_expression (binary_expression left: (identifier) right: (array_access array: (identifier) index: (identifier)))) consequence: (block (expression_statement (assignment_expression left: (identifier) right: (array_access array: (identifier) index: (identifier)))) (expression_statement (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (array_access array: (identifier) index: (identifier)))))) alternative: (if_statement condition: (parenthesized_expression (binary_expression left: (identifier) right: (array_access array: (identifier) index: (identifier)))) consequence: (block (expression_statement (assignment_expression left: (identifier) right: (array_access array: (identifier) index: (identifier)))) (expression_statement (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (array_access array: (identifier) index: (identifier)))))) alternative: (block (expression_statement (method_invocation object: (field_access object: (identifier) field: (identifier)) name: (identifier) arguments: (argument_list (unary_expression operand: (decimal_integer_literal))))) (expression_statement (assignment_expression left: (identifier) right: (decimal_integer_literal))) (break_statement))))))) (if_statement condition: (parenthesized_expression (binary_expression left: (identifier) right: (decimal_integer_literal))) consequence: (block (enhanced_for_statement type: (integral_type) name: (identifier) value: (identifier) body: (expression_statement (method_invocation object: (field_access object: (identifier) field: (identifier)) name: (identifier) arguments: (argument_list (binary_expression left: (identifier) right: (string_literal)))))) (expression_statement (method_invocation object: (field_access object: (identifier) field: (identifier)) name: (identifier) arguments: (argument_list))) (enhanced_for_statement type: (integral_type) name: (identifier) value: (identifier) body: (expression_statement (method_invocation object: (field_access object: (identifier) field: (identifier)) name: (identifier) arguments: (argument_list (binary_expression left: (identifier) right: (string_literal)))))) (expression_statement (method_invocation object: (field_access object: (identifier) field: (identifier)) name: (identifier) arguments: (argument_list)))))))