#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  char pos[4] = {'v', '<', '^', '>'};
  char a, b;
  int dur;
  cin >> a >> b >> dur;
  int index = -1;
  if (a == 'v') {
    index = 0;
  } else if (a == '<') {
    index = 1;
  } else if (a == '^') {
    index = 2;
  } else {
    index = 3;
  }
  bool cw = false;
  bool ccw = false;
  if (pos[(index + dur) % 4] == b) {
    cw = true;
  }
  if (pos[((index - (dur % 4) + 4)) % 4] == b) {
    ccw = true;
  }
  if (ccw && cw) {
    cout << "undefined"
         << "\n";
  } else if (cw) {
    cout << "cw"
         << "\n";
  } else {
    cout << "ccw"
         << "\n";
  }
  return 0;
}
