public static void main ( String [ ] args ) {
  String h [ ] = new String [ 2 ] ;
  h [ 0 ] = input . next ( ) ;
  h [ 1 ] = input . next ( ) ;
  int homecards [ ] = new int [ 100 ] ;
  int awaycards [ ] = new int [ 100 ] ;
  int redcards [ ] [ ] = new int [ 100 ] [ 3 ] ;
  int n = input . nextInt ( ) ;
  int ri = 0 ;
  for ( int i = 0 ;
  i < n ;
  i ++ ) {
    int minute = input . nextInt ( ) ;
    String TeamName = input . next ( ) ;
    int Number = input . nextInt ( ) ;
    String color = input . next ( ) ;
    if ( TeamName . equals ( "h" ) && homecards [ Number ] != 2 ) {
      if ( color . equals ( "y" ) ) homecards [ Number ] ++ ;
      else homecards [ Number ] = 2 ;
      if ( homecards [ Number ] == 2 ) {
        redcards [ ri ] [ 0 ] = 0 ;
        redcards [ ri ] [ 1 ] = Number ;
        redcards [ ri ] [ 2 ] = minute ;
        ri ++ ;
      }
    }
    else if ( TeamName . equals ( "a" ) && awaycards [ Number ] != 2 ) {
      if ( color . equals ( "y" ) ) awaycards [ Number ] ++ ;
      else awaycards [ Number ] = 2 ;
      if ( awaycards [ Number ] == 2 ) {
        redcards [ ri ] [ 0 ] = 1 ;
        redcards [ ri ] [ 1 ] = Number ;
        redcards [ ri ] [ 2 ] = minute ;
        ri ++ ;
      }
    }
  }
  for ( int i = 0 ;
  i < ri ;
  i ++ ) {
    System . out . println ( h [ redcards [ i ] [ 0 ] ] + " " + redcards [ i ] [ 1 ] + " " + redcards [ i ] [ 2 ] ) ;
  }
}

public static void main ( String [ ] args ) { String h [ ] = new String [ 2 ] ; h [ 0 ] = input . next ( ) ; h [ 1 ] = input . next ( ) ; int homecards [ ] = new int [ 100 ] ; int awaycards [ ] = new int [ 100 ] ; int redcards [ ] [ ] = new int [ 100 ] [ 3 ] ; int n = input . nextInt ( ) ; int ri = 0 ; for ( int i = 0 ; i < n ; i ++ ) { int minute = input . nextInt ( ) ; String TeamName = input . next ( ) ; int Number = input . nextInt ( ) ; String color = input . next ( ) ; if ( TeamName . equals ( " h " ) && homecards [ Number ] != 2 ) { if ( color . equals ( " y " ) ) homecards [ Number ] ++ ; else homecards [ Number ] = 2 ; if ( homecards [ Number ] == 2 ) { redcards [ ri ] [ 0 ] = 0 ; redcards [ ri ] [ 1 ] = Number ; redcards [ ri ] [ 2 ] = minute ; ri ++ ; } } else if ( TeamName . equals ( " a " ) && awaycards [ Number ] != 2 ) { if ( color . equals ( " y " ) ) awaycards [ Number ] ++ ; else awaycards [ Number ] = 2 ; if ( awaycards [ Number ] == 2 ) { redcards [ ri ] [ 0 ] = 1 ; redcards [ ri ] [ 1 ] = Number ; redcards [ ri ] [ 2 ] = minute ; ri ++ ; } } } for ( int i = 0 ; i < ri ; i ++ ) { System . out . println ( h [ redcards [ i ] [ 0 ] ] + " ▁ " + redcards [ i ] [ 1 ] + " ▁ " + redcards [ i ] [ 2 ] ) ; } }
(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) dimensions: (dimensions) value: (array_creation_expression type: (type_identifier) dimensions: (dimensions_expr (decimal_integer_literal))))) (expression_statement (assignment_expression left: (array_access array: (identifier) index: (decimal_integer_literal)) right: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list)))) (expression_statement (assignment_expression left: (array_access array: (identifier) index: (decimal_integer_literal)) right: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list)))) (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) dimensions: (dimensions) value: (array_creation_expression type: (integral_type) dimensions: (dimensions_expr (decimal_integer_literal))))) (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) dimensions: (dimensions) value: (array_creation_expression type: (integral_type) dimensions: (dimensions_expr (decimal_integer_literal))))) (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) dimensions: (dimensions) value: (array_creation_expression type: (integral_type) dimensions: (dimensions_expr (decimal_integer_literal)) dimensions: (dimensions_expr (decimal_integer_literal))))) (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: (integral_type) declarator: (variable_declarator name: (identifier) value: (decimal_integer_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 (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)))) (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)))) (if_statement condition: (parenthesized_expression (binary_expression left: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (string_literal))) right: (binary_expression left: (array_access array: (identifier) index: (identifier)) right: (decimal_integer_literal)))) consequence: (block (if_statement condition: (parenthesized_expression (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (string_literal)))) consequence: (expression_statement (update_expression (array_access array: (identifier) index: (identifier)))) alternative: (expression_statement (assignment_expression left: (array_access array: (identifier) index: (identifier)) right: (decimal_integer_literal)))) (if_statement condition: (parenthesized_expression (binary_expression left: (array_access array: (identifier) index: (identifier)) right: (decimal_integer_literal))) consequence: (block (expression_statement (assignment_expression left: (array_access array: (array_access array: (identifier) index: (identifier)) index: (decimal_integer_literal)) right: (decimal_integer_literal))) (expression_statement (assignment_expression left: (array_access array: (array_access array: (identifier) index: (identifier)) index: (decimal_integer_literal)) right: (identifier))) (expression_statement (assignment_expression left: (array_access array: (array_access array: (identifier) index: (identifier)) index: (decimal_integer_literal)) right: (identifier))) (expression_statement (update_expression (identifier)))))) alternative: (if_statement condition: (parenthesized_expression (binary_expression left: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (string_literal))) right: (binary_expression left: (array_access array: (identifier) index: (identifier)) right: (decimal_integer_literal)))) consequence: (block (if_statement condition: (parenthesized_expression (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (string_literal)))) consequence: (expression_statement (update_expression (array_access array: (identifier) index: (identifier)))) alternative: (expression_statement (assignment_expression left: (array_access array: (identifier) index: (identifier)) right: (decimal_integer_literal)))) (if_statement condition: (parenthesized_expression (binary_expression left: (array_access array: (identifier) index: (identifier)) right: (decimal_integer_literal))) consequence: (block (expression_statement (assignment_expression left: (array_access array: (array_access array: (identifier) index: (identifier)) index: (decimal_integer_literal)) right: (decimal_integer_literal))) (expression_statement (assignment_expression left: (array_access array: (array_access array: (identifier) index: (identifier)) index: (decimal_integer_literal)) right: (identifier))) (expression_statement (assignment_expression left: (array_access array: (array_access array: (identifier) index: (identifier)) index: (decimal_integer_literal)) right: (identifier))) (expression_statement (update_expression (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: (identifier)) update: (update_expression (identifier)) body: (block (expression_statement (method_invocation object: (field_access object: (identifier) field: (identifier)) name: (identifier) arguments: (argument_list (binary_expression left: (binary_expression left: (binary_expression left: (binary_expression left: (array_access array: (identifier) index: (array_access array: (array_access array: (identifier) index: (identifier)) index: (decimal_integer_literal))) right: (string_literal)) right: (array_access array: (array_access array: (identifier) index: (identifier)) index: (decimal_integer_literal))) right: (string_literal)) right: (array_access array: (array_access array: (identifier) index: (identifier)) index: (decimal_integer_literal))))))))))