func VisitInput(input *Input, f func(*Input)) {
	switch {
	case input == nil:
		return // Spouts may have nil input
	case input.Cross != nil:
		for _, input := range input.Cross {
			VisitInput(input, f)
		}
	case input.Union != nil:
		for _, input := range input.Union {
			VisitInput(input, f)
		}
	}
	f(input)
}
func VisitInput(input *Input, f func(*Input)) {
	switch {
	case input == nil:
		return // Spouts may have nil input
	case input.Cross != nil:
		for _, input := range input.Cross {
			VisitInput(input, f)
		}
	case input.Union != nil:
		for _, input := range input.Union {
			VisitInput(input, f)
		}
	}
	f(input)
}
// VisitInput visits each input recursively in ascending order (root last)