defaultdict is slower iirc, that is why I didn't use it before.