Statistical mechanics of cosmic strings.