#include <bits/stdc++.h>
using namespace std;
map<char, int> ma;
int main() {
  ma['v'] = 0;
  ma['<'] = 1;
  ma['^'] = 2;
  ma['>'] = 3;
  char c1, c2;
  cin >> c1 >> c2;
  int n;
  cin >> n;
  n %= 4;
  if (n == 2 || n == 0) {
    cout << "undefined" << endl;
  } else if (n == 1) {
    int temp = ma[c2] - ma[c1];
    if (temp < 0) {
      temp += 4;
    }
    if (temp == 1) {
      cout << "cw" << endl;
    } else if (temp == 3) {
      cout << "ccw" << endl;
    } else {
      cout << "undefined" << endl;
    }
  } else if (n == 3) {
    int temp = ma[c2] - ma[c1];
    if (temp < 0) {
      temp += 4;
    }
    if (temp == 1) {
      cout << "ccw" << endl;
    } else if (temp == 3) {
      cout << "cw" << endl;
    } else {
      cout << "undefined" << endl;
    }
  }
  return 0;
}
