This won't work if the shortest sequence is not the first.