package main

import (
	"bufio"
	"fmt"
	"math"
	"os"
	"strings"
)

func main() {
	inp := strings.ToLower(StdinToString())
	dirs := strings.Split(inp, ",")
	var currX, currY, currZ int
	var furthest float64
	for i := range dirs {
		switch dirs[i] {
		case "n":
			currY++
			currZ--
		case "ne":
			currX++
			currZ--
		case "se":
			currY--
			currX++
		case "s":
			currY--
			currZ++
		case "sw":
			currX--
			currZ++
		case "nw":
			currY++
			currX--
		}
		if math.Abs(float64(currX)) > furthest {
			furthest = math.Abs(float64(currX))
		}
		if math.Abs(float64(currY)) > furthest {
			furthest = math.Abs(float64(currY))
		}
		if math.Abs(float64(currZ)) > furthest {
			furthest = math.Abs(float64(currZ))
		}
	}
	fmt.Println(currY, currX, currZ)
	fmt.Println("Furthest:", furthest)
}

func StdinToString() string {
	var input string
	scanner := bufio.NewScanner(os.Stdin)
	for scanner.Scan() {
		input = scanner.Text()
	}
	return input
}
