This is what I think:
Firstly, the technique is, do bitwise AND with subnet- the network ids given, those who return the same values are in the same subnet.
The parts of the subnet which are 255 will spit out what we give them, they are all 1's so we already know first three octets after multiplication for all three network IDs. They will be the same.
The last octet of the subnet, 252 only matters. Break it to get the binary - 128+64+32+16+8+4 = 11111100. Doing bitwise AND with this binary number will spit out same nos till 6th-bit rest will be eaten by 0's.
The last octets of net ids are - 2-> 000000'10, 5-> 000001'01, 6-> 000001'10 (The ' symbol shows how far the bits survive)
So for 5 and 6 same bit pattern survives, basically, ANDing 252 with 2 gives 0, with 5 gives 4, with 6 gives 4.
As 5 and 6 return same values, they are in the same subnet.