#include <bits/stdc++.h>
using namespace std;
int main() {
  char F, E, G;
  int n;
  cin >> F;
  cin >> E;
  cin >> n;
  for (int x = 1; x <= n; x++) {
    switch (F) {
      case 94:
        F = 62;
        break;
      case 62:
        F = 'v';
        break;
      case 'v':
        F = 60;
        break;
      case 60:
        F = 94;
        break;
    }
  }
  if (n % 2 == 0) {
    cout << "undefined";
  } else if (F == E) {
    cout << "cw";
  } else {
    cout << "ccw";
  }
  return 0;
}
