#include <bits/stdc++.h>
using namespace std;
int32_t main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  char CW[4] = {'^', '>', 'v', '<'};
  char CCW[4] = {'^', '<', 'v', '>'};
  char st, en;
  int n;
  cin >> st >> en >> n;
  int s1, s2;
  for (int i = 0; i < 4; ++i) {
    if (CW[i] == st) s1 = i;
  }
  for (int i = 0; i < 4; ++i) {
    if (CCW[i] == st) s2 = i;
  }
  int e1, e2;
  e1 = CW[(s1 + n) % 4];
  e2 = CCW[(s2 + n) % 4];
  if (e1 == e2) {
    cout << "undefined\n";
    return 0;
  }
  if (e1 == en) {
    cout << "cw\n";
  } else {
    cout << "ccw\n";
  }
  return 0;
}
