#include <bits/stdc++.h>
using namespace std;
const long long N = 24;
long long n;
void solve() {
  char x, y;
  cin >> x >> y;
  cin >> n;
  map<char, long long> mp;
  mp['^'] = 1;
  mp['<'] = 2;
  mp['v'] = 3;
  mp['>'] = 0;
  n = n % 4;
  long long check = (mp[x] - mp[y] + 4) % 4;
  if (check % 2 == 0) {
    cout << "undefined";
  } else if (check == n) {
    cout << "cw";
  } else {
    cout << "ccw";
  }
}
int32_t main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  solve();
  cout << endl;
  return 0;
}
