@c = grep { defined($b[0]) and !($b[0] eq $_) or !shift @b } sort {$a <=> $b} @a;