AC-3 algorithm