A couple of days ago I posted an answer to this which I believe is a better answer than the others, as it is the most general in nature. Unfortunately the question was missing a good deal of information about what assumptions should be made, and what had already been tried, so the question was put on hold.
Having said that I think it was an interesting question to which I had a novel answer. Is it OK to edit the question to fill in some of the assumptions that might need to be made for a correct solution?
I don't know how fair this is - obviously I would set up the question in such a way that my answer is clearly the correct one.
Obviously I can't truthfully add details of what the OP has already tried, as I don't have those details.