[fix] checking for either pair in near duplicate checking