this problem was a rollercoaster of dumb edge cases. My solution performed juuuust badly enough (~ 3mins), that when pt 2 didn't finish, I didn't think anything of it, and was WAY more patient than I should have been about a long-running process. (more after the break)