#include <bits/stdc++.h>
using namespace std;
void fast() {
  std::ios::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
}
int main() {
  fast();
  char ch1, ch2, a[] = {'v', '<', '^', '>'};
  int n, flag1 = 0, flag2 = 0, pos;
  cin >> ch1 >> ch2 >> n;
  n %= 4;
  for (int i = 0; i < 4; i++)
    if (ch1 == a[i]) pos = i;
  if (ch2 == a[(pos + n) % 4]) flag1 = 1;
  if (ch2 == a[pos - n < 0 ? 3 - (n - pos - 1) : pos - n]) flag2 = 1;
  if (flag1 == flag2) return cout << "undefined", 0;
  if (flag1)
    return cout << "cw", 0;
  else
    return cout << "ccw", 0;
}
