#include <bits/stdc++.h>
using namespace std;
const int N = 3e5 + 1;
const int K = 200;
const int M = 1e9 + 7;
const double eps = 1e-6;
char f, t, k;
map<char, int> mp;
int main() {
  ios::sync_with_stdio(0), cin.tie(0), cout.tie(0);
  mp['v'] = 0;
  mp['<'] = 1;
  mp['^'] = 2;
  mp['>'] = 3;
  cin >> f >> t;
  int time;
  cin >> time;
  time %= 4;
  if (f == t) {
    cout << "undefined\n";
  } else if (abs(mp[t] - mp[f]) & 1) {
    if (time == 1) {
      if ((mp[t] - mp[f] + 4) % 4 == 1)
        cout << "cw\n";
      else
        cout << "ccw\n";
    } else {
      if ((mp[t] - mp[f] + 4) % 4 == 3)
        cout << "cw\n";
      else
        cout << "ccw\n";
    }
  } else {
    cout << "undefined\n";
  }
}
