we just check connectivity on the front-end kind of naively by ensuring each square is adjacent to another. is that union-find? I didn't do well in algorithms class..