#include <bits/stdc++.h>
using namespace std;
int main() {
  char a, b;
  cin >> a >> b;
  int n;
  cin >> n;
  n = n % 4;
  if (n == 0) {
    cout << "undefined";
    return 0;
  }
  int arr[] = {118, 60, 94, 62};
  int arr2[] = {118, 62, 94, 60};
  int i = 0;
  for (i = 0; i < 4; i++) {
    if (a == arr[i]) break;
  }
  char c = arr[i];
  for (int j = 1; j <= n; j++) {
    i = (i + 1) % 4;
    c = arr[i];
  }
  int k = 0;
  for (k = 0; k < 4; k++) {
    if (a == arr2[k]) break;
  }
  char d = arr[k];
  for (int j = 1; j <= n; j++) {
    k = (k + 1) % 4;
    d = arr2[k];
  }
  if (c == b && d == b)
    cout << "undefined";
  else if (c == b)
    cout << "cw";
  else
    cout << "ccw";
  return 0;
}
