#include <bits/stdc++.h>
using namespace std;
int main() {
  char cw[4] = {'v', '<', '^', '>'};
  char ccw[4] = {'v', '>', '^', '<'};
  char startc, endc;
  int cwspos, cwendpos, ccwspos, ccwendpos;
  int n;
  cin >> startc >> endc >> n;
  for (int i = 0; i < 4; i++) {
    if (startc == cw[i]) cwspos = i;
    if (endc == cw[i]) cwendpos = i;
    if (startc == ccw[i]) ccwspos = i;
    if (endc == ccw[i]) ccwendpos = i;
  }
  int flag1 = 0;
  int flag2 = 0;
  if ((cwspos + n % 4) % 4 == cwendpos) flag1 = 1;
  if ((ccwspos + n % 4) % 4 == ccwendpos) flag2 = 1;
  if (flag1 == 1 && flag2 == 0)
    cout << "cw" << endl;
  else if (flag2 == 1 && flag1 == 0)
    cout << "ccw" << endl;
  else
    cout << "undefined" << endl;
  return 0;
}
