simply done for the q1, but how to deal with the big number of XY is still left to be considered