#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const int sz = 1e5 + 10;
char c[] = {'^', '>', 'v', '<'};
int main() {
  char a, b;
  int n, st, na, nb;
  while (cin >> a >> b >> n) {
    for (st = 0; c[st] != a; st++) {
    }
    na = (st + n) % 4;
    nb = ((st - n) % 4 + 4) % 4;
    if (b == c[na] && b == c[nb])
      cout << "undefined\n";
    else if (b == c[na])
      cout << "cw\n";
    else if (b == c[nb])
      cout << "ccw\n";
    else
      cout << "undefined\n";
  }
  return 0;
}
