#include <bits/stdc++.h>
using namespace std;
int main() {
  char arr[4], a, b;
  arr[0] = 118;
  arr[1] = 60;
  arr[2] = 94;
  arr[3] = 62;
  cin >> a >> b;
  int i, j, n;
  cin >> n;
  for (i = 0; i < 4; i++) {
    if (a == arr[i]) break;
  }
  for (j = 0; j < 4; j++) {
    if (b == arr[j]) break;
  }
  if (arr[(i + n) % 4] == arr[j] && arr[(j + n) % 4] == arr[i]) {
    cout << "undefined";
    return 0;
  }
  if (arr[(i + n) % 4] == arr[j]) {
    cout << "cw";
    return 0;
  }
  if (arr[(j + n) % 4] == arr[i]) {
    cout << "ccw";
    return 0;
  }
  cout << "undefined";
  return 0;
}
