Continual Learning of a Mixed Sequence of Similar and Dissimilar Tasks