public static void main ( String [ ] args ) throws IOException {
  BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ;
  StringTokenizer tokenizer = new StringTokenizer ( br . readLine ( ) ) ;
  int R = Integer . parseInt ( tokenizer . nextToken ( ) ) ;
  int C = Integer . parseInt ( tokenizer . nextToken ( ) ) ;
  int Q = Integer . parseInt ( tokenizer . nextToken ( ) ) ;
  int [ ] [ ] A = new int [ R ] [ C ] ;
  for ( int r = 0 ;
  r < R ;
  r ++ ) {
    tokenizer = new StringTokenizer ( br . readLine ( ) ) ;
    for ( int c = 0 ;
    c < C ;
    c ++ ) {
      A [ r ] [ c ] = Integer . parseInt ( tokenizer . nextToken ( ) ) ;
    }
  }
  int [ ] rows = new int [ R ] ;
  int [ ] columns = new int [ C ] ;
  for ( int r = 0 ;
  r < R ;
  r ++ ) {
    rows [ r ] = r ;
  }
  for ( int c = 0 ;
  c < C ;
  c ++ ) {
    columns [ c ] = c ;
  }
  StringBuilder output = new StringBuilder ( ) ;
  for ( int q = 0 ;
  q < Q ;
  q ++ ) {
    tokenizer = new StringTokenizer ( br . readLine ( ) ) ;
    char type = tokenizer . nextToken ( ) . charAt ( 0 ) ;
    int x = Integer . parseInt ( tokenizer . nextToken ( ) ) - 1 ;
    int y = Integer . parseInt ( tokenizer . nextToken ( ) ) - 1 ;
    if ( type == 'c' ) {
      int temp = columns [ x ] ;
      columns [ x ] = columns [ y ] ;
      columns [ y ] = temp ;
    }
    else if ( type == 'r' ) {
      int temp = rows [ x ] ;
      rows [ x ] = rows [ y ] ;
      rows [ y ] = temp ;
    }
    else {
      int answer = A [ rows [ x ] ] [ columns [ y ] ] ;
      output . append ( answer ) . append ( '\n' ) ;
    }
  }
  System . out . print ( output ) ;
}

public static void main ( String [ ] args ) throws IOException { BufferedReader br = new BufferedReader ( new InputStreamReader ( System . in ) ) ; StringTokenizer tokenizer = new StringTokenizer ( br . readLine ( ) ) ; int R = Integer . parseInt ( tokenizer . nextToken ( ) ) ; int C = Integer . parseInt ( tokenizer . nextToken ( ) ) ; int Q = Integer . parseInt ( tokenizer . nextToken ( ) ) ; int [ ] [ ] A = new int [ R ] [ C ] ; for ( int r = 0 ; r < R ; r ++ ) { tokenizer = new StringTokenizer ( br . readLine ( ) ) ; for ( int c = 0 ; c < C ; c ++ ) { A [ r ] [ c ] = Integer . parseInt ( tokenizer . nextToken ( ) ) ; } } int [ ] rows = new int [ R ] ; int [ ] columns = new int [ C ] ; for ( int r = 0 ; r < R ; r ++ ) { rows [ r ] = r ; } for ( int c = 0 ; c < C ; c ++ ) { columns [ c ] = c ; } StringBuilder output = new StringBuilder ( ) ; for ( int q = 0 ; q < Q ; q ++ ) { tokenizer = new StringTokenizer ( br . readLine ( ) ) ; char type = tokenizer . nextToken ( ) . charAt ( 0 ) ; int x = Integer . parseInt ( tokenizer . nextToken ( ) ) - 1 ; int y = Integer . parseInt ( tokenizer . nextToken ( ) ) - 1 ; if ( type == ' c ' ) { int temp = columns [ x ] ; columns [ x ] = columns [ y ] ; columns [ y ] = temp ; } else if ( type == ' r ' ) { int temp = rows [ x ] ; rows [ x ] = rows [ y ] ; rows [ y ] = temp ; } else { int answer = A [ rows [ x ] ] [ columns [ y ] ] ; output . append ( answer ) . append ( ' \n ' ) ; } } System . out . print ( output ) ; }
(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 (field_access object: (identifier) field: (identifier)))))))) (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)))))) (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: (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: (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: (array_type element: (integral_type) dimensions: (dimensions)) declarator: (variable_declarator name: (identifier) value: (array_creation_expression type: (integral_type) dimensions: (dimensions_expr (identifier)) dimensions: (dimensions_expr (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 (assignment_expression left: (identifier) right: (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: (identifier)) update: (update_expression (identifier)) body: (block (expression_statement (assignment_expression left: (array_access array: (array_access array: (identifier) index: (identifier)) index: (identifier)) right: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (method_invocation object: (identifier) name: (identifier) arguments: (argument_list)))))))))) (local_variable_declaration type: (array_type element: (integral_type) dimensions: (dimensions)) declarator: (variable_declarator name: (identifier) value: (array_creation_expression type: (integral_type) dimensions: (dimensions_expr (identifier))))) (local_variable_declaration type: (array_type element: (integral_type) dimensions: (dimensions)) declarator: (variable_declarator name: (identifier) value: (array_creation_expression type: (integral_type) dimensions: (dimensions_expr (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 (assignment_expression left: (array_access array: (identifier) index: (identifier)) right: (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 (assignment_expression left: (array_access array: (identifier) index: (identifier)) right: (identifier))))) (local_variable_declaration type: (type_identifier) declarator: (variable_declarator name: (identifier) value: (object_creation_expression type: (type_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: (identifier)) update: (update_expression (identifier)) body: (block (expression_statement (assignment_expression left: (identifier) right: (object_creation_expression type: (type_identifier) arguments: (argument_list (method_invocation object: (identifier) name: (identifier) arguments: (argument_list)))))) (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) value: (method_invocation object: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list)) name: (identifier) arguments: (argument_list (decimal_integer_literal))))) (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) value: (binary_expression left: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (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: (binary_expression left: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (method_invocation object: (identifier) name: (identifier) arguments: (argument_list)))) right: (decimal_integer_literal)))) (if_statement condition: (parenthesized_expression (binary_expression left: (identifier) right: (character_literal))) consequence: (block (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) value: (array_access array: (identifier) index: (identifier)))) (expression_statement (assignment_expression left: (array_access array: (identifier) index: (identifier)) right: (array_access array: (identifier) index: (identifier)))) (expression_statement (assignment_expression left: (array_access array: (identifier) index: (identifier)) right: (identifier)))) alternative: (if_statement condition: (parenthesized_expression (binary_expression left: (identifier) right: (character_literal))) consequence: (block (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) value: (array_access array: (identifier) index: (identifier)))) (expression_statement (assignment_expression left: (array_access array: (identifier) index: (identifier)) right: (array_access array: (identifier) index: (identifier)))) (expression_statement (assignment_expression left: (array_access array: (identifier) index: (identifier)) right: (identifier)))) alternative: (block (local_variable_declaration type: (integral_type) declarator: (variable_declarator name: (identifier) value: (array_access array: (array_access array: (identifier) index: (array_access array: (identifier) index: (identifier))) index: (array_access array: (identifier) index: (identifier))))) (expression_statement (method_invocation object: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (identifier))) name: (identifier) arguments: (argument_list (character_literal))))))))) (expression_statement (method_invocation object: (field_access object: (identifier) field: (identifier)) name: (identifier) arguments: (argument_list (identifier))))))