#include <bits/stdc++.h>
using namespace std;
const int N = 500005;
int f(char c) {
  if (c == '^') return 1;
  if (c == '>') return 2;
  if (c == 'v') return 3;
  return 4;
}
int main() {
  std::ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  char a, b;
  cin >> a >> b;
  long long n;
  cin >> n;
  int x, y;
  x = f(a);
  y = f(b);
  bool ans1 = 0, ans2 = 0;
  int cw = y - x;
  if (cw < 0) cw += 4;
  int ccw = x - y;
  if (ccw < 0) ccw += 4;
  if (cw == ccw)
    cout << "undefined";
  else if ((n % 4) == ccw)
    cout << "ccw";
  else if ((n % 4) == cw)
    cout << "cw";
}
