#include <bits/stdc++.h>
using namespace std;
bool check(char a, char b, string s, int k) {
  int p = 0;
  for (int i = 0; i < 4; ++i)
    if (a == s[i]) p = i;
  return s[(p + k) % 4] == b;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  string s = "v<^>";
  char a, b;
  cin >> a >> b;
  int n;
  cin >> n;
  n %= 4;
  bool cw = check(a, b, s, n);
  bool ccw = check(b, a, s, n);
  if (cw && ccw)
    cout << "undefined" << endl;
  else if (cw)
    cout << "cw" << endl;
  else
    cout << "ccw" << endl;
}
