#include <bits/stdc++.h>
using namespace std;
inline long long getint() {
  long long _x = 0, _tmp = 1;
  char _tc = getchar();
  while ((_tc < '0' || _tc > '9') && _tc != '-') _tc = getchar();
  if (_tc == '-') _tc = getchar(), _tmp = -1;
  while (_tc >= '0' && _tc <= '9') _x *= 10, _x += (_tc - '0'), _tc = getchar();
  return _x * _tmp;
}
bool _cmp(const pair<int, int>& i, const pair<int, int>& j) {
  return ((i.first == j.first) ? (i.second > j.second) : (i.first < j.first));
}
struct Node {
  int x, y;
  Node(int a = 0, int b = 0) : x(a), y(b) {}
  bool operator<(const Node& a) const {
    return ((x == a.x) ? (y > a.y) : (x < a.x));
  }
};
const int mxn = 1e0 + 1;
double eps = 1e-9;
long long ncase = 1;
long long N, M, a, b, c;
string in1, in2;
map<char, int> mp;
int st, en;
void pre() { return; }
void init() {
  mp['v'] = 0;
  mp['<'] = 1;
  mp['^'] = 2;
  mp['>'] = 3;
  cin >> in1 >> in2 >> N;
  st = mp[in1[0]];
  en = mp[in2[0]];
}
void sol() {
  N %= 4;
  if ((st + N) % 4 == en && (st + 4 - N) % 4 == en)
    puts("undefined");
  else if ((st + N) % 4 == en)
    puts("cw");
  else if ((st + 4 - N) % 4 == en)
    puts("ccw");
  else
    puts("undefined");
  return;
}
int main() {
  pre();
  while (ncase--) {
    init();
    sol();
  }
}
