The next prime minister will have to cobble together a coalition.