#include <bits/stdc++.h>
using namespace std;
int main() {
  char aa, bb;
  cin >> aa >> bb;
  int n;
  cin >> n;
  n = n % 4;
  int a, b;
  switch (aa) {
    case 'v':
      a = 0;
      break;
    case '<':
      a = 1;
      break;
    case '^':
      a = 2;
      break;
    case '>':
      a = 3;
      break;
  }
  switch (bb) {
    case 'v':
      b = 0;
      break;
    case '<':
      b = 1;
      break;
    case '^':
      b = 2;
      break;
    case '>':
      b = 3;
      break;
  }
  int f1, f2;
  f1 = 0;
  f2 = 0;
  if ((a + n) % 4 == b) f1 = 1;
  if ((a - n + 4) % 4 == b) f2 = 1;
  if (f1 == 1 && f2 == 1)
    cout << "undefined";
  else if (f1 == 1)
    cout << "cw";
  else
    cout << "ccw";
}
