The isomorphism problem for classes of graphs closed under contraction