x=['<','^','>','v']
s,e=input().split()
it=int(input())
for i in range(len(x)):
if(x[i]==s):
sp=i
for i in range(len(x)):
if(x[i]==e):
ep=i
if(((sp+it)%4)==((sp-it)%4)):
print('undefined')
elif(x[((sp+it)%4)]==x[ep]):
print('cw')
elif(x[((sp-it)%4)]==x[ep]):
print('ccw')
else:
print('undefined')
#include <bits/stdc++.h>
using namespace std;
int main()
{
char a[2];
int b[2];
for (int i = 0; i < 2; i++)
{
cin >> a[i];
if (a[i] == 'v')
b[i] = a[i] - 117;
if (a[i] == '<')
b[i] = a[i] - 58;
if (a[i] == '>')
b[i] = a[i] - 58;
if (a[i] == '^')
b[i] = a[i] - 91;
}
int n;
cin >> n;
n = n % 4;
if (n == 0 || n == 2)
{
cout << "undefined";
}
else
{
if (abs(b[0] - b[1]) % 2 == 0)
{
cout << "undefined";
}
else
{
if (b[1] > b[0] && b[1] - b[0] == n)
{
cout << "cw";
}
else if (b[1] > b[0] && b[1] - b[0] != n)
{
cout << "ccw";
}
else if (b[0] > b[1] && b[0] - b[1] == n)
{
cout << "ccw";
}
else if (b[0] > b[1] && b[0] - b[1] != n)
{
cout << "cw";
}
}
}
return 0;
}
1633C - Kill the Monster | 1611A - Make Even |
1030B - Vasya and Cornfield | 1631A - Min Max Swap |
1296B - Food Buying | 133A - HQ9+ |
1650D - Twist the Permutation | 1209A - Paint the Numbers |
1234A - Equalize Prices Again | 1613A - Long Comparison |
1624B - Make AP | 660B - Seating On Bus |
405A - Gravity Flip | 499B - Lecture |
709A - Juicer | 1358C - Celex Update |
1466B - Last minute enhancements | 450B - Jzzhu and Sequences |
1582C - Grandma Capa Knits a Scarf | 492A - Vanya and Cubes |
217A - Ice Skating | 270A - Fancy Fence |
181A - Series of Crimes | 1638A - Reverse |
1654C - Alice and the Cake | 369A - Valera and Plates |
1626A - Equidistant Letters | 977D - Divide by three multiply by two |
1654B - Prefix Removals | 1654A - Maximum Cake Tastiness |