This is a puzzel that if you think about it too much you are stuffed and won't solve it. I thought about this for a while and was coming up with all sorts of algorithms to solve it, the thing was it was working but not all the time. Then like the biblical burning bush, beam of light out of the clouds I saw the answer and hit myself for taking a good 30 minutes to see it