Write a time machine quine
CJam, 25

L{\_l~(&gt;1&lt;lN+a@+`@"_~"}_~


Try it online

Explanation:

L      push an empty array (this is the array of previous strings)
{…}    push this block
_      duplicate the block
~      execute the 2nd copy (the stack contains the array and the block)


The block:

\      swap the array with the block
_      duplicate the array
l      read a line from the input (containing the integer n)
~(     evaluate n and decrement it
&gt;      slice the array starting at that position
1&lt;     slice the resulting array to keep only the first string (if any)
l      read the 2nd line from the input (containing the string)
N+     append a newline
a      wrap in an array
@      bring the previous array to the top
+      concatenate the arrays, thus prepending the new string
`      convert the array to its string representation
@      bring the block to the top
"_~"   push this string


At the end, the requested string (if any), the array's representation, the block and the string "_~" are printed automatically.