#include <bits/stdc++.h>
using namespace std;
const string cw = "^>v<^>v<";
const string ccw = "^<v>^<v>";
void docfile() {
  ios::sync_with_stdio(false);
  cin.tie(nullptr);
  if (ifstream("test"
               ".inp")) {
    freopen(
        "test"
        ".inp",
        "r", stdin);
    freopen(
        "test"
        ".out",
        "w", stdout);
  } else if (ifstream(""
                      ".inp")) {
    freopen(
        ""
        ".inp",
        "r", stdin);
    freopen(
        ""
        ".out",
        "w", stdout);
  }
}
void enter() {
  char c1, c2;
  int n;
  cin >> c1 >> c2;
  cin >> n;
  n %= 4;
  if (labs(cw.substr(cw.find(c1), cw.size()).find(c2)) == n &&
      labs(ccw.substr(ccw.find(c1), ccw.size()).find(c2)) == n)
    cout << "undefined";
  else if (labs(cw.substr(cw.find(c1), cw.size()).find(c2)) == n)
    cout << "cw";
  else if (labs(ccw.substr(ccw.find(c1), ccw.size()).find(c2)) == n)
    cout << "ccw";
  else
    cout << "undefined";
}
void init() {}
void solve() {}
void print_result() {}
int main() {
  docfile();
  int t = 1;
  for (int tt = 0; tt < t; ++tt) {
    enter();
    init();
    solve();
    print_result();
  }
}
