Whenever you have a "if not in, initialize to x" type stuff, you can use a `defaultdict`