I did that a long time ago and my code for it was a terrible mess. I just remember that I had two Ideas of which one worked much better but is very very unclean. first I made something with divinding the fields into two and than compare points with a simple funktion in the format of f(x)=2x or something like that.
The other goodworking thing, that I can't really recommmend, even though it was easy was that I made a black and white picture of such a grid. Now I could check where the user clicked and determine if it was on the top or bottom field of the overlapping fields, because I got the color.
(that was a little confusing now, but I think you can figure out what I meant )