#include <bits/stdc++.h>
using namespace std;
char num[4] = {'v', '<', '^', '>'};
char num1[4] = {'v', '>', '^', '<'};
int main() {
  char a, b;
  long long n;
  while (cin >> a >> b >> n) {
    int temp1 = -1, temp2 = -1;
    for (int i = 0; i < 4; i++) {
      if (a == num[i]) {
        temp1 = i;
      }
      if (a == num1[i]) {
        temp2 = i;
      }
    }
    if (num[(temp1 + n) % 4] == b && num1[(temp2 + n) % 4] == b) {
      cout << "undefined" << endl;
    } else if (num1[(temp2 + n) % 4] == b) {
      cout << "ccw" << endl;
    } else if (num[(temp1 + n) % 4] == b) {
      cout << "cw" << endl;
    }
  }
  return 0;
}
