Reading about them, it seems they migrate in winter (like half a mile uphill), but the adults always return to the same breeding pond in spring, so that information is stored somewhere.
I'm not surprised. There have been studies that show caterpillars retain memories through metamorphosis into a butterfly (a process that basically liquefies them).