#include <bits/stdc++.h>
using namespace std;
int main() {
  std::ios::sync_with_stdio(false);
  cin.tie(0);
  string s1, s2;
  int n;
  cin >> s1 >> s2 >> n;
  if (n % 4 == 0) {
    cout << "undefined";
  } else if (n % 4 == 1) {
    if ((s1 == "^" && s2 == ">") || (s1 == ">" && s2 == "v") ||
        (s1 == "v" && s2 == "<") || (s1 == "<" && s2 == "^"))
      cout << "cw";
    else if ((s1 == "^" && s2 == "<") || (s1 == "<" && s2 == "v") ||
             (s1 == "v" && s2 == ">") || (s1 == ">" && s2 == "^"))
      cout << "ccw";
    else
      cout << "undefined";
  } else if (n % 4 == 2) {
    cout << "undefined";
  } else {
    if ((s1 == "^" && s2 == "<") || (s1 == ">" && s2 == "^") ||
        (s1 == "v" && s2 == ">") || (s1 == "<" && s2 == "v"))
      cout << "cw";
    else if ((s1 == "^" && s2 == ">") || (s1 == "<" && s2 == "^") ||
             (s1 == "v" && s2 == "<") || (s1 == ">" && s2 == "v"))
      cout << "ccw";
    else
      cout << "undefined";
  }
  return 0;
}
