Algorithm with Kim(Possible)