public static void main ( String [ ] args ) {
  Scanner sc = new Scanner ( System . in ) ;
  int n = sc . nextInt ( ) ;
  List < Integer > list1 = new ArrayList < > ( ) ;
  List < Integer > list2 = new ArrayList < > ( ) ;
  List < Integer > list3 = new ArrayList < > ( ) ;
  for ( int i = 0 ;
  i < n ;
  i ++ ) {
    int temp = sc . nextInt ( ) ;
    if ( temp < 0 ) list1 . add ( temp ) ;
    else if ( temp > 0 ) list2 . add ( temp ) ;
    else list3 . add ( temp ) ;
  }
  if ( list2 . size ( ) == 0 ) {
    int num1 = list1 . remove ( list1 . size ( ) - 1 ) ;
    int num2 = list1 . remove ( list1 . size ( ) - 1 ) ;
    list2 . add ( num1 ) ;
    list2 . add ( num2 ) ;
  }
  if ( list1 . size ( ) % 2 == 0 ) {
    list3 . add ( list1 . remove ( list1 . size ( ) - 1 ) ) ;
  }
  sc . close ( ) ;
  System . out . print ( list1 . size ( ) ) ;
  for ( int i = 0 ;
  i < list1 . size ( ) ;
  i ++ ) System . out . print ( " " + list1 . get ( i ) ) ;
  System . out . println ( ) ;
  System . out . print ( list2 . size ( ) ) ;
  for ( int i = 0 ;
  i < list2 . size ( ) ;
  i ++ ) System . out . print ( " " + list2 . get ( i ) + " " ) ;
  System . out . println ( ) ;
  System . out . print ( list3 . size ( ) ) ;
  for ( int i = 0 ;
  i < list3 . size ( ) ;
  i ++ ) System . out . print ( " " + list3 . get ( i ) + " " ) ;
}

public static void main ( String [ ] args ) { Scanner sc = new Scanner ( System . in ) ; int n = sc . nextInt ( ) ; List < Integer > list1 = new ArrayList < > ( ) ; List < Integer > list2 = new ArrayList < > ( ) ; List < Integer > list3 = new ArrayList < > ( ) ; for ( int i = 0 ; i < n ; i ++ ) { int temp = sc . nextInt ( ) ; if ( temp < 0 ) list1 . add ( temp ) ; else if ( temp > 0 ) list2 . add ( temp ) ; else list3 . add ( temp ) ; } if ( list2 . size ( ) == 0 ) { int num1 = list1 . remove ( list1 . size ( ) - 1 ) ; int num2 = list1 . remove ( list1 . size ( ) - 1 ) ; list2 . add ( num1 ) ; list2 . add ( num2 ) ; } if ( list1 . size ( ) % 2 == 0 ) { list3 . add ( list1 . remove ( list1 . size ( ) - 1 ) ) ; } sc . close ( ) ; System . out . print ( list1 . size ( ) ) ; for ( int i = 0 ; i < list1 . size ( ) ; i ++ ) System . out . print ( " ▁ " + list1 . get ( i ) ) ; System . out . println ( ) ; System . out . print ( list2 . size ( ) ) ; for ( int i = 0 ; i < list2 . size ( ) ; i ++ ) System . out . print ( " ▁ " + list2 . get ( i ) + " ▁ " ) ; System . out . println ( ) ; System . out . print ( list3 . size ( ) ) ; for ( int i = 0 ; i < list3 . size ( ) ; i ++ ) System . out . print ( " ▁ " + list3 . get ( i ) + " ▁ " ) ; }
(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)))) (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)))) (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)))) (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)))) (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)))) (if_statement condition: (parenthesized_expression (binary_expression left: (identifier) right: (decimal_integer_literal))) consequence: (expression_statement (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (identifier)))) alternative: (if_statement condition: (parenthesized_expression (binary_expression left: (identifier) right: (decimal_integer_literal))) consequence: (expression_statement (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (identifier)))) alternative: (expression_statement (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (identifier)))))))) (if_statement condition: (parenthesized_expression (binary_expression left: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list)) right: (decimal_integer_literal))) consequence: (block (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) value: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (binary_expression left: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list)) right: (decimal_integer_literal)))))) (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) value: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (binary_expression left: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list)) right: (decimal_integer_literal)))))) (expression_statement (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (identifier)))) (expression_statement (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (identifier)))))) (if_statement condition: (parenthesized_expression (binary_expression left: (binary_expression left: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list)) right: (decimal_integer_literal)) right: (decimal_integer_literal))) consequence: (block (expression_statement (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (binary_expression left: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list)) right: (decimal_integer_literal))))))))) (expression_statement (method_invocation object: (identifier) name: (identifier) arguments: (argument_list))) (expression_statement (method_invocation object: (field_access object: (identifier) field: (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: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list))) update: (update_expression (identifier)) body: (expression_statement (method_invocation object: (field_access object: (identifier) field: (identifier)) name: (identifier) arguments: (argument_list (binary_expression left: (string_literal) right: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (identifier)))))))) (expression_statement (method_invocation object: (field_access object: (identifier) field: (identifier)) name: (identifier) arguments: (argument_list))) (expression_statement (method_invocation object: (field_access object: (identifier) field: (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: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list))) update: (update_expression (identifier)) body: (expression_statement (method_invocation object: (field_access object: (identifier) field: (identifier)) name: (identifier) arguments: (argument_list (binary_expression left: (binary_expression left: (string_literal) right: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (identifier)))) right: (string_literal)))))) (expression_statement (method_invocation object: (field_access object: (identifier) field: (identifier)) name: (identifier) arguments: (argument_list))) (expression_statement (method_invocation object: (field_access object: (identifier) field: (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: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list))) update: (update_expression (identifier)) body: (expression_statement (method_invocation object: (field_access object: (identifier) field: (identifier)) name: (identifier) arguments: (argument_list (binary_expression left: (binary_expression left: (string_literal) right: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (identifier)))) right: (string_literal))))))))