Masking porblem

So basically i have somth like on picture attached, now i place a lot of small boxes in either square 1 or square 2 area,and i can’t know where small box will be placed.
now i’m trying to make a function that checks if y-cords of small box is in square 2 and make some action. Think it shouldn’t be smth difficult, tried some if statement but coudn’t get math to work. so can som1 mybe help me work math out or suggest some more simple sollution?

also the hierarchy is like this
addChild(holder);
addChild(mask)
holder.mask = mask;
holder.addChild(smallBox);