#include <bits/stdc++.h>
using namespace std;
map<char, int> m;
int n, a, b;
char s[3], ss[3];
void input() {
  scanf("%s%s", s, ss);
  scanf("%d", &n);
}
void output() {
  if (b == n && a != n)
    printf("ccw\n");
  else if (a == n && b != n)
    printf("cw\n");
  else
    printf("undefined\n");
}
int main() {
  m['V'] = 0;
  m['<'] = 1;
  m['^'] = 2;
  m['>'] = 3;
  input();
  n = n % 4;
  b = (m[s[0]] + 4 - m[ss[0]]) % 4;
  a = (m[ss[0]] + 4 - m[s[0]]) % 4;
  output();
  return 0;
}
