#include <bits/stdc++.h>
using namespace std;
int n;
int a[500][500];
int b[500][500];
char stra[10];
char strb[10];
int main() {
  a['v']['v'] = 0;
  a['v']['<'] = 1;
  a['v']['^'] = 2;
  a['v']['>'] = 3;
  a['<']['v'] = 3;
  a['<']['<'] = 0;
  a['<']['^'] = 1;
  a['<']['>'] = 2;
  a['^']['v'] = 2;
  a['^']['<'] = 3;
  a['^']['^'] = 0;
  a['^']['>'] = 1;
  a['>']['v'] = 1;
  a['>']['<'] = 2;
  a['>']['^'] = 3;
  a['>']['>'] = 0;
  b['v']['v'] = 0;
  b['v']['<'] = 3;
  b['v']['^'] = 2;
  b['v']['>'] = 1;
  b['<']['v'] = 1;
  b['<']['<'] = 0;
  b['<']['^'] = 3;
  b['<']['>'] = 2;
  b['^']['v'] = 2;
  b['^']['<'] = 1;
  b['^']['^'] = 0;
  b['^']['>'] = 3;
  b['>']['v'] = 3;
  b['>']['<'] = 2;
  b['>']['^'] = 1;
  b['>']['>'] = 0;
  scanf("%s", stra);
  scanf("%s", strb);
  scanf("%d", &n);
  int ansa = 0;
  if (n % 4 == a[stra[0]][strb[0]]) {
    ansa += 1;
  }
  if (n % 4 == b[stra[0]][strb[0]]) {
    ansa += 2;
  }
  if (ansa == 1) {
    puts("cw");
  } else if (ansa == 2) {
    puts("ccw");
  } else {
    puts("undefined");
  }
  return 0;
}
