Another variant for generating pairs