public static void main ( String [ ] args ) throws Exception {
  try {
    FastReader sc = new FastReader ( ) ;
    String a = sc . next ( ) ;
    String b = sc . next ( ) ;
    int n = sc . nextInt ( ) ;
    System . out . println ( a + " " + b ) ;
    while ( n != 0 ) {
      String c = sc . next ( ) ;
      String d = sc . next ( ) ;
      if ( c . equals ( a ) ) {
        a = d ;
      }
      else {
        b = d ;
      }
      System . out . println ( a + " " + b ) ;
    }
  }
  catch ( Exception e ) {
  }
}

public static void main ( String [ ] args ) throws Exception { try { FastReader sc = new FastReader ( ) ; String a = sc . next ( ) ; String b = sc . next ( ) ; int n = sc . nextInt ( ) ; System . out . println ( a + " ▁ " + b ) ; while ( n != 0 ) { String c = sc . next ( ) ; String d = sc . next ( ) ; if ( c . equals ( a ) ) { a = d ; } else { b = d ; } System . out . println ( a + " ▁ " + b ) ; } } catch ( Exception e ) { } }
(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 (try_statement body: (block (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: (type_identifier) 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)))) (expression_statement (method_invocation object: (field_access object: (identifier) field: (identifier)) name: (identifier) arguments: (argument_list (binary_expression left: (binary_expression left: (identifier) right: (string_literal)) right: (identifier))))) (while_statement condition: (parenthesized_expression (binary_expression left: (identifier) right: (decimal_integer_literal))) body: (block (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: (type_identifier) declarator: (variable_declarator name: (identifier) value: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list)))) (if_statement condition: (parenthesized_expression (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (identifier)))) consequence: (block (expression_statement (assignment_expression left: (identifier) right: (identifier)))) alternative: (block (expression_statement (assignment_expression left: (identifier) right: (identifier))))) (expression_statement (method_invocation object: (field_access object: (identifier) field: (identifier)) name: (identifier) arguments: (argument_list (binary_expression left: (binary_expression left: (identifier) right: (string_literal)) right: (identifier)))))))) (catch_clause (catch_formal_parameter (catch_type (type_identifier)) name: (identifier)) body: (block)))))