#include <bits/stdc++.h>
using namespace std;
unsigned int test(char x) {
  if (x == 'v') {
    return 0;
  }
  if (x == '<') {
    return 1;
  }
  if (x == '^') {
    return 2;
  }
  if (x == '>') {
    return 3;
  }
  return -1;
}
int main(int argc, char const *argv[]) {
  char i, o;
  int pos_i, pos_o, ass_c, ass_a, t;
  scanf("%c %c %d", &i, &o, &t);
  pos_i = test(i);
  pos_o = test(o);
  ass_c = (pos_i + t) % 4;
  ass_a = (pos_i + 1000000000 - t) % 4;
  if ((ass_a == pos_o) && (ass_c == pos_o)) {
    printf("undefined\n");
  } else if (ass_c == pos_o) {
    printf("cw\n");
  } else if (ass_a == pos_o) {
    printf("ccw\n");
  }
  return 0;
}
