public static void main ( String [ ] args ) {
  Scanner scan = new Scanner ( System . in ) ;
  String s = scan . nextLine ( ) ;
  int n = scan . nextInt ( ) ;
  Integer start = state ( s . charAt ( 0 ) ) ;
  Integer end = state ( s . charAt ( 2 ) ) ;
  n = n % 4 ;
  List < Integer > cw = Arrays . asList ( 1 , 2 , 3 , 4 , 1 , 2 , 3 , 4 ) ;
  List < Integer > ccw = Arrays . asList ( 1 , 4 , 3 , 2 , 1 , 4 , 3 , 2 ) ;
  String result ;
  boolean isCw = cw . get ( cw . indexOf ( start ) + n ) == end ;
  boolean isCcw = ccw . get ( ccw . indexOf ( start ) + n ) == end ;
  if ( isCw && ! isCcw ) {
    result = "cw" ;
  }
  else if ( isCcw && ! isCw ) {
    result = "ccw" ;
  }
  else {
    result = "undefined" ;
  }
  System . out . println ( result ) ;
}

public static void main ( String [ ] args ) { Scanner scan = new Scanner ( System . in ) ; String s = scan . nextLine ( ) ; int n = scan . nextInt ( ) ; Integer start = state ( s . charAt ( 0 ) ) ; Integer end = state ( s . charAt ( 2 ) ) ; n = n % 4 ; List < Integer > cw = Arrays . asList ( 1 , 2 , 3 , 4 , 1 , 2 , 3 , 4 ) ; List < Integer > ccw = Arrays . asList ( 1 , 4 , 3 , 2 , 1 , 4 , 3 , 2 ) ; String result ; boolean isCw = cw . get ( cw . indexOf ( start ) + n ) == end ; boolean isCcw = ccw . get ( ccw . indexOf ( start ) + n ) == end ; if ( isCw && ! isCcw ) { result = " cw " ; } else if ( isCcw && ! isCw ) { result = " ccw " ; } else { result = " undefined " ; } System . out . println ( result ) ; }
(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: (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 name: (identifier) arguments: (argument_list (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (decimal_integer_literal))))))) (local_variable_declaration type: (type_identifier) declarator: (variable_declarator name: (identifier) value: (method_invocation name: (identifier) arguments: (argument_list (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (decimal_integer_literal))))))) (expression_statement (assignment_expression left: (identifier) right: (binary_expression left: (identifier) right: (decimal_integer_literal)))) (local_variable_declaration type: (generic_type (type_identifier) (type_arguments (type_identifier))) declarator: (variable_declarator name: (identifier) value: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (decimal_integer_literal) (decimal_integer_literal) (decimal_integer_literal) (decimal_integer_literal) (decimal_integer_literal) (decimal_integer_literal) (decimal_integer_literal) (decimal_integer_literal))))) (local_variable_declaration type: (generic_type (type_identifier) (type_arguments (type_identifier))) declarator: (variable_declarator name: (identifier) value: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (decimal_integer_literal) (decimal_integer_literal) (decimal_integer_literal) (decimal_integer_literal) (decimal_integer_literal) (decimal_integer_literal) (decimal_integer_literal) (decimal_integer_literal))))) (local_variable_declaration type: (type_identifier) declarator: (variable_declarator name: (identifier))) (local_variable_declaration type: (boolean_type) declarator: (variable_declarator name: (identifier) value: (binary_expression left: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (binary_expression left: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (identifier))) right: (identifier)))) right: (identifier)))) (local_variable_declaration type: (boolean_type) declarator: (variable_declarator name: (identifier) value: (binary_expression left: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (binary_expression left: (method_invocation object: (identifier) name: (identifier) arguments: (argument_list (identifier))) right: (identifier)))) right: (identifier)))) (if_statement condition: (parenthesized_expression (binary_expression left: (identifier) right: (unary_expression operand: (identifier)))) consequence: (block (expression_statement (assignment_expression left: (identifier) right: (string_literal)))) alternative: (if_statement condition: (parenthesized_expression (binary_expression left: (identifier) right: (unary_expression operand: (identifier)))) consequence: (block (expression_statement (assignment_expression left: (identifier) right: (string_literal)))) alternative: (block (expression_statement (assignment_expression left: (identifier) right: (string_literal)))))) (expression_statement (method_invocation object: (field_access object: (identifier) field: (identifier)) name: (identifier) arguments: (argument_list (identifier))))))