#include <bits/stdc++.h>
using namespace std;
const long base = 1e9 + 7;
const long esp = 1e-10;
const int maxn = 1 * 1e5 + 1;
const double pi = atan(1) * 4;
inline long long gcd(long long a, long long b) {
  long long r;
  while (b) {
    r = a % b;
    a = b;
    b = r;
  }
  return a;
}
inline long long lcm(long long a, long long b) { return a / gcd(a, b) * b; }
char cw[4] = {'^', '>', 'v', '<'};
char ccw[4] = {'^', '<', 'v', '>'};
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  char s, t;
  int n;
  bool flagcw = false, flagccw = false;
  cin >> s >> t;
  cin >> n;
  if (n == 0 and (s != t)) {
    cout << "undefined";
    return 0;
  }
  for (int i = 0; i < 4; i++) {
    if (cw[i] == s) {
      int tmp = (i + 1 + n) % 4 - 1;
      if (tmp == -1) tmp = 3;
      if (cw[tmp] == t) {
        flagcw = true;
      }
    }
  }
  for (int i = 0; i < 4; i++) {
    if (ccw[i] == s) {
      int tmp = (i + 1 + n) % 4 - 1;
      if (tmp == -1) tmp = 3;
      if (ccw[tmp] == t) {
        flagccw = true;
      }
    }
  }
  if ((flagccw and flagcw) or (flagccw == false and flagcw == false))
    cout << "undefined";
  else if (flagcw and flagccw == false)
    cout << "cw";
  else
    cout << "ccw";
  return 0;
}
