Tricky part, got the test data correct at part 1 long before the actual input gace the correct answers. Pure luck I guess. Part 2 I got stuck on, and resolved to visualization by a loop of prints.