#include <bits/stdc++.h>
using namespace std;
const int MOD = 1000000007;
const int N = 2e6 + 13, M = N;
long long n, m, k, v, u, w, c, q, qVal;
void solve() {
  char s, e;
  char arr[4] = {'v', '<', '^', '>'};
  cin >> s >> e;
  int idx = 0, spun = 0;
  cin >> spun;
  for (int i = 0; i < 4; i++) {
    if (s == arr[i]) {
      idx = i;
    }
  }
  int cw = (idx + spun) % 4;
  int ccw = ((idx - spun) + 4) % 4;
  if (abs(idx - cw) == 2 || abs(idx - ccw) == 2 || idx == cw)
    cout << "undefined\n";
  else if (arr[cw] == e)
    cout << "cw\n";
  else
    cout << "ccw\n";
}
int main() {
  solve();
  return 0;
}
