public static void main ( String [ ] args ) throws IOException {
  BufferedReader reader = new BufferedReader ( new FileReader ( "input.txt" ) ) ;
  int N = Integer . parseInt ( reader . readLine ( ) ) ;
  Map < Integer , List < Integer >> map = new HashMap < Integer , List < Integer >> ( ) ;
  StringTokenizer tokenizer = new StringTokenizer ( reader . readLine ( ) ) ;
  for ( int n = 0 ;
  n < 2 * N ;
  n ++ ) {
    int a = Integer . parseInt ( tokenizer . nextToken ( ) ) ;
    map . computeIfAbsent ( a , key -> new ArrayList < Integer > ( ) ) . add ( n + 1 ) ;
  }
  PrintWriter out = new PrintWriter ( new File ( "output.txt" ) ) ;
  StringBuilder output = new StringBuilder ( ) ;
  for ( List < Integer > list : map . values ( ) ) {
    if ( list . size ( ) % 2 == 0 ) {
      int i = 0 ;
      while ( i < list . size ( ) ) {
        output . append ( list . get ( i ++ ) ) . append ( ' ' ) . append ( list . get ( i ++ ) ) . append ( '\n' ) ;
      }
    }
    else {
      out . println ( "-1" ) ;
      out . close ( ) ;
      return ;
    }
  }
  out . print ( output ) ;
  out . close ( ) ;
}

public static void main ( String [ ] args ) throws IOException { BufferedReader reader = new BufferedReader ( new FileReader ( " input . txt " ) ) ; int N = Integer . parseInt ( reader . readLine ( ) ) ; Map < Integer , List < Integer > > map = new HashMap < Integer , List < Integer > > ( ) ; StringTokenizer tokenizer = new StringTokenizer ( reader . readLine ( ) ) ; for ( int n = 0 ; n < 2 * N ; n ++ ) { int a = Integer . parseInt ( tokenizer . nextToken ( ) ) ; map . computeIfAbsent ( a , key -> new ArrayList < Integer > ( ) ) . add ( n + 1 ) ; } PrintWriter out = new PrintWriter ( new File ( " output . txt " ) ) ; StringBuilder output = new StringBuilder ( ) ; for ( List < Integer > list : map . values ( ) ) { if ( list . size ( ) % 2 == 0 ) { int i = 0 ; while ( i < list . size ( ) ) { output . append ( list . get ( i ++ ) ) . append ( ' ▁ ' ) . append ( list . get ( i ++ ) ) . append ( ' \n ' ) ; } } else { out . println ( " - 1" ) ; out . close ( ) ; return ; } } out . print ( output ) ; out . close ( ) ; }
(method_declaration (modifiers) type: (void_type) name: (identifier) parameters: (formal_parameters (formal_parameter type: (array_type element: (type_identifier) dimensions: (dimensions)) name: (identifier))) (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 (string_literal))))))) (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) value: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (method_invocation object: (identifier) name: (identifier) arguments: (argument_list)))))) (local_variable_declaration type: (generic_type (type_identifier) (type_arguments (type_identifier) (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) (generic_type (type_identifier) (type_arguments (type_identifier))))) arguments: (argument_list)))) (local_variable_declaration type: (type_identifier) declarator: (variable_declarator name: (identifier) value: (object_creation_expression type: (type_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: (binary_expression left: (decimal_integer_literal) 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 (method_invocation object: (identifier) name: (identifier) arguments: (argument_list)))))) (expression_statement (method_invocation object: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (identifier) (lambda_expression parameters: (identifier) body: (object_creation_expression type: (generic_type (type_identifier) (type_arguments (type_identifier))) arguments: (argument_list))))) name: (identifier) arguments: (argument_list (binary_expression left: (identifier) right: (decimal_integer_literal))))))) (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 (string_literal))))))) (local_variable_declaration type: (type_identifier) declarator: (variable_declarator name: (identifier) value: (object_creation_expression type: (type_identifier) arguments: (argument_list)))) (enhanced_for_statement type: (generic_type (type_identifier) (type_arguments (type_identifier))) name: (identifier) value: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list)) body: (block (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 (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) value: (decimal_integer_literal))) (while_statement condition: (parenthesized_expression (binary_expression left: (identifier) right: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list)))) body: (block (expression_statement (method_invocation object: (method_invocation object: (method_invocation object: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (update_expression (identifier)))))) name: (identifier) arguments: (argument_list (character_literal))) name: (identifier) arguments: (argument_list (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (update_expression (identifier)))))) name: (identifier) arguments: (argument_list (character_literal))))))) alternative: (block (expression_statement (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (string_literal)))) (expression_statement (method_invocation object: (identifier) name: (identifier) arguments: (argument_list))) (return_statement))))) (expression_statement (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (identifier)))) (expression_statement (method_invocation object: (identifier) name: (identifier) arguments: (argument_list)))))