#include <bits/stdc++.h>
using namespace std;
int ctor(char n) {
  switch (n) {
    case '^':
      return 0;
    case '>':
      return 1;
    case 'v':
      return 2;
    case '<':
      return 3;
  }
}
int main() {
  ios_base::sync_with_stdio(false);
  string a, b;
  int t;
  cin >> a >> b >> t;
  t %= 4;
  if (t == 0 || t == 2) {
    cout << "undefined" << endl;
  } else if (t == 1) {
    if (ctor(a[0]) == (ctor(b[0]) + 1) % 4) {
      cout << "ccw" << endl;
    } else {
      cout << "cw" << endl;
    }
  } else if (t == 3) {
    if (ctor(a[0]) == (ctor(b[0]) + 1) % 4) {
      cout << "cw" << endl;
    } else {
      cout << "ccw" << endl;
    }
  }
  return 0;
}
