recuse version of painter's problem