#include <bits/stdc++.h>
using namespace std;
int n;
char a[3], b[3];
int getNum(char *str) {
  if (str[0] == '^')
    return 0;
  else if (str[0] == '>')
    return 1;
  else if (str[0] == 'v')
    return 2;
  else
    return 3;
}
int main() {
  while (~scanf("%s%s", a, b)) {
    int t;
    scanf("%d", &t);
    t %= 4;
    int d1 = getNum(a);
    int d2 = getNum(b);
    int d = d1 - d2;
    if (abs(d) == 2 || d == 0)
      printf("undefined\n");
    else if ((d + 4) % 4 == t)
      printf("ccw\n");
    else if ((4 - d) % 4 == t)
      printf("cw\n");
    else
      printf("undefined\n");
  }
  return 0;
}
