"All You Zombies" is a science fiction short story by Robert A. Heinlein that was first published in Fantasy and Science Fiction magazine in 1959. The story involves a number of paradoxes involving time travel.

Warning: Wikipedia contains spoilers

The plot of "All You Zombies" concerns a young man who is taken back in time and tricked into impregnating himself (before he had had a sex-change operation), resulting in the ultimate time-travel paradox: a man who is both his own father and mother.

The story involves an intricate series of time travel jumps, beginning September 20, 1945 when the Bartender drops off baby Jane at an orphanage. Nearly 18 years later, the Bartender takes the male "Unmarried Mother" to April 3, 1963 where he seduces the 17-year-old hermaphrodite Jane. Shortly thereafter, the Bartender brings the seducer to the Rockies base (at an undisclosed time).

After being seduced, Jane becomes pregnant. After giving birth, she has a "sex change", i.e., her female parts are removed. On March 10, 1964 the Bartender picks up the baby and brings it back in time to the orphanage.

On November 7, 1970 the Bartender meets the Unmarried Mother and brings him back in time (1963) to "find" the man who got him pregnant.