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