#include <bits/stdc++.h>
using namespace std;
int main() {
  char c1, c2, left[] = "^<v>", right[] = "^>v<";
  int n;
  cin >> c1 >> c2 >> n;
  n %= 4;
  bool Ok1 = 0, Ok2 = 0;
  for (int i = 0; i < 4; i++) {
    if (left[i] == c1) {
      if (left[(i + n) % 4] == c2) {
        Ok1 = 1;
        break;
      }
    }
  }
  for (int i = 0; i < 4; i++) {
    if (right[i] == c1) {
      if (right[(i + n) % 4] == c2) {
        Ok2 = 1;
        break;
      }
    }
  }
  if (Ok1 && Ok2) {
    cout << "undefined";
  } else if (Ok1) {
    cout << "ccw";
  } else if (Ok2) {
    cout << "cw";
  } else {
    cout << "undefined";
  }
  return 0;
}
