#include <bits/stdc++.h>
using namespace std;
int main() {
  char st, en;
  cin >> st >> en;
  int n;
  cin >> n;
  n = n % 4;
  char cl, ccl;
  string cc = "v<^>v";
  string ac = "v>^<v";
  int ccpos, acpos;
  for (int i = 0; i < cc.size(); ++i) {
    if (cc[i] == st) {
      ccpos = i;
    }
    if (ac[i] == st) {
      acpos = i;
    }
  }
  ccpos = (ccpos + n) % 4;
  acpos = (acpos + n) % 4;
  if (cc[ccpos] == en && ac[acpos] != en) {
    cout << "cw" << endl;
  } else if (cc[ccpos] != en && ac[acpos] == en) {
    cout << "ccw" << endl;
  } else {
    cout << "undefined" << endl;
  }
  return 0;
}
