#include <bits/stdc++.h>
using namespace std;
int n;
char a[5];
char s1[3], s2[3];
void solve() {
  int i, vt, kq1, kq2;
  scanf("%d", &n);
  n = n % 4;
  a[0] = 'v';
  a[1] = '<';
  a[2] = '^';
  a[3] = '>';
  for (i = 0; i < 4; i++)
    if (a[i] == s1[0]) vt = i;
  kq1 = 0;
  kq2 = 0;
  if (a[(vt + n) % 4] == s2[0]) kq1 = 1;
  if (a[(vt - n + 4) % 4] == s2[0]) kq2 = 1;
  if (kq1 == 1 && kq2 == 0) printf("cw\n");
  if (kq1 == 0 && kq2 == 1) printf("ccw\n");
  if ((kq1 == 0 && kq2 == 0) || (kq1 == 1 && kq2 == 1)) printf("undefined\n");
}
int main() {
  while (scanf("%s %s", &s1, &s2) > 0) {
    solve();
  }
  return 0;
}
