#include <bits/stdc++.h>
using namespace std;
int n, m;
int arr[4][4];
int f(char x) {
  if (x == 94) return 0;
  if (x == 62) return 1;
  if (x == 118) return 2;
  if (x == 60) return 3;
  return 0;
}
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  int s;
  char x, y;
  cin >> x >> y >> s;
  n = f(x);
  m = f(y);
  s %= 4;
  arr[0][1] = 1;
  arr[0][3] = 3;
  arr[1][2] = 1;
  arr[1][0] = 3;
  arr[2][3] = 1;
  arr[2][1] = 3;
  arr[3][0] = 1;
  arr[3][2] = 3;
  if (n == m || abs(n + m) % 2 == 0) {
    cout << "undefined" << endl;
    return 0;
  }
  if (arr[n][m] == s)
    cout << "cw" << endl;
  else
    cout << "ccw" << endl;
  return 0;
}
