SPOILER WARNING: I tend to leave the answers as comments in the code. As I understand it not everyone gets the same input, so these answers may not work for you, but if you have the same inputs as me...
Written with 3.10 but will probably work in 3.6+ as I generally don't use any features newer than f-strings.