Cosmic archaeology with gravitational waves from cosmic strings