#include <bits/stdc++.h>
int trans[256];
int main() {
  int from, to;
  int n;
  int cwpos, ccwpos;
  trans[118] = 0;
  trans[60] = 1;
  trans[94] = 2;
  trans[62] = 3;
  from = trans[getchar()];
  (void)getchar();
  to = trans[getchar()];
  (void)scanf("%d", &n);
  cwpos = (from + n % 4) % 4;
  ccwpos = (from + (n + 2 * (n % 2)) % 4) % 4;
  if (cwpos == ccwpos)
    printf("undefined\n");
  else if (cwpos == to)
    printf("cw\n");
  else if (ccwpos == to)
    printf("ccw\n");
  else
    printf("undefined\n");
  return 0;
}
