#include <bits/stdc++.h>
using namespace std;
int main() {
  char a, b;
  int n, i;
  cin >> a >> b >> n;
  n = n % 4;
  bool cw = false, ccw = false;
  char temp = a;
  for (i = 0; i < n; i++) {
    if (temp == '^')
      temp = '>';
    else if (temp == '>')
      temp = 'v';
    else if (temp == 'v')
      temp = '<';
    else if (temp == '<')
      temp = '^';
  }
  if (temp == b) cw = true;
  temp = a;
  for (i = 0; i < n; i++) {
    if (temp == '^')
      temp = '<';
    else if (temp == '<')
      temp = 'v';
    else if (temp == 'v')
      temp = '>';
    else if (temp == '>')
      temp = '^';
  }
  if (temp == b) ccw = true;
  if (cw && ccw)
    cout << "undefined";
  else if (cw)
    cout << "cw";
  else if (ccw)
    cout << "ccw";
  return 0;
}
