my @sg = sort {$a<=>$b} uniq grep {defined} (@v2g{@$i}, min @$i);