```go
package main
import "fmt"
func main() {
var startStr, endStr string
var n int
// Using fmt.Scan to parse whitespace-separated input (strings and integer)
fmt.Scan(&startStr, &endStr, &n)
// Map characters to integers based on clockwise order:
// v (down) -> < (left) -> ^ (up) -> > (right) -> v ...
// This corresponds to indices 0, 1, 2, 3.
toInt := func(c string) int {
switch c {
case "v":
return 0
case "<":
return 1
case "^":
return 2
case ">":
return 3
}
return 0
}
start := toInt(startStr)
end := toInt(endStr)
// Cycle repeats every 4 seconds
n %= 4
// Calculate predicted end positions for both directions
cw := (start + n) % 4
ccw := (start - n + 4) % 4
// Check matches
if cw == end && ccw == end {
fmt.Println("undefined")
} else if cw == end {
fmt.Println("cw")
} else {
// Since input is guaranteed valid, if not cw and not undefined, must be ccw
fmt.Println("ccw")
}
}
```