#include <bits/stdc++.h>
char data[5] = "v<^>";
int i;
void test(int a, int b, char c) {
  if (data[(a + b) % 4] == c)
    i = 0;
  else if (data[(a - b + 4) % 4] == c)
    i = 1;
  else
    i = -1;
}
int main(void) {
  long n;
  char a, b;
  scanf("%c %c%ld", &a, &b, &n);
  n = n % 4;
  if (n == 0 || n == 2) {
    printf("undefined");
    return 0;
  }
  switch (a) {
    case 'v':
      test(0, n, b);
      break;
    case '<':
      test(1, n, b);
      break;
    case '^':
      test(2, n, b);
      break;
    case '>':
      test(3, n, b);
      break;
  }
  if (i == 1)
    printf("ccw");
  else if (i == 0)
    printf("cw");
  else
    printf("undefined");
  return 0;
}
