#include <bits/stdc++.h>
using namespace std;
int main() {
  char v1, v2;
  int t, flag1, flag2;
  map<char, int> v;
  while (cin >> v1 >> v2) {
    cin >> t;
    t = t % 4;
    v['^'] = 0;
    v['>'] = 1;
    v['v'] = 2;
    v['<'] = 3;
    bool x = (v[v1] + t) % 4 == v[v2];
    bool y = ((v[v1] - t + 4) % 4) == v[v2];
    if (x && y)
      cout << "undefined" << endl;
    else if (x)
      cout << "cw" << endl;
    else
      cout << "ccw" << endl;
  }
}
