#include <bits/stdc++.h>
using namespace std;
const int maxn = 1e5 + 20;
const int INF = 0x3f3f3f3f;
int A[maxn];
map<char, int> dp;
int main(void) {
  dp['v'] = 0, dp['<'] = 1, dp['^'] = 2, dp['>'] = 3;
  int n;
  char a, b;
  cin >> a >> b;
  cin >> n;
  n = n % 4;
  if ((dp[a] + n) % 4 == dp[b] && (dp[a] - n + 4) % 4 == dp[b]) {
    puts("undefined");
  } else if ((dp[a] + n) % 4 == dp[b]) {
    puts("cw");
  } else if ((dp[a] - n + 4) % 4 == dp[b]) {
    puts("ccw");
  } else
    cout << "undefined";
  return 0;
}
