#include <bits/stdc++.h>
using namespace std;
int main() {
  long long T, i, j, n;
  char c[2], ca[4] = {'v', '<', '^', '>'}, a, b;
  cin >> a >> b;
  map<char, long long> m;
  m[ca[0]] = 1;
  m[ca[1]] = 2;
  m[ca[2]] = 3;
  m[ca[3]] = 4;
  cin >> n;
  n = n % 4;
  if (n == 0)
    cout << "undefined" << endl;
  else if (m[a] <= m[b]) {
    if (m[b] - m[a] == 2)
      cout << "undefined" << endl;
    else if (m[b] - m[a] == n)
      cout << "cw" << endl;
    else if (4 - m[b] + m[a] == n)
      cout << "ccw" << endl;
    else
      cout << "undefined" << endl;
  } else {
    if (m[a] - m[b] == 2)
      cout << "undefined" << endl;
    else if (4 - m[a] + m[b] == n)
      cout << "cw" << endl;
    else if (m[a] - m[b] == n)
      cout << "ccw" << endl;
    else
      cout << "undefined" << endl;
  }
}
