#include <bits/stdc++.h>
using namespace std;
int main() {
  char a, b;
  scanf("%c %c\n", &a, &b);
  int n;
  scanf("%d", &n);
  n %= 4;
  if (a == b) {
    printf("undefined\n");
    return 0;
  }
  bool cw = 0, ccw = 0;
  char c[10] = {118, 60, 94, 62, 118, 60, 94, 62};
  char c1[10] = {62, 94, 60, 118, 62, 94, 60, 118};
  int start = 0, end = 0;
  for (int i = 0; i < 5; i++) {
    start = i;
    if (c[i] == a) break;
  }
  for (int j = start + 1; j < 10; j++) {
    end = j;
    if (c[j] == b) break;
  }
  if (end - start == n) {
    cw = 1;
  }
  start = 0, end = 0;
  for (int i = 0; i < 5; i++) {
    start = i;
    if (c1[i] == a) break;
  }
  for (int j = start + 1; j < 10; j++) {
    end = j;
    if (c1[j] == b) break;
  }
  if (end - start == n) ccw = 1;
  if ((cw and ccw) or (!cw and !ccw))
    printf("undefined\n");
  else if (cw)
    printf("cw\n");
  else
    printf("ccw\n");
}
