finding pairs with nub