Hungarian match for formation detection.