"Space"
Amy is trying to get the Doctor's attention while he fixes the TARDIS. She discovers that Rory is helping the Doctor by installing thermal couplings underneath the glass floor of the TARDIS. Rory and Amy then start a small argument, when the TARDIS suddenly shakes and the lights go out. The Doctor asks Rory if he dropped a thermal coupling, which Rory admits to and apologizes for doing. Amy then apologizes as well, and, at the Doctor's confusion, explains that Rory was looking up her skirt through the glass floor when he dropped the thermal coupling. The Doctor then notes that they have landed through "emergency materialization" which should have landed the TARDIS in the safest space available. The lights come on, revealing another TARDIS inside the control room - the TARDIS has materialized inside itself. The Doctor experimentally walks through the door of the TARDIS inside the control room and instantly walks back into the control room through the door of the outer TARDIS. The Doctor tells Rory and Amy that they are trapped in a "space loop" and that nothing can enter or exit the TARDIS ever again. Despite the Doctor's words, another Amy enters through the TARDIS outer door saying "Okay kids, this is where it gets complicated."
"Time"
Continuing from the ending of "Space", the other Amy reveals that she is from a few moments in the future, and is able to come into the current outer TARDIS because "the exterior shell of the TARDIS has drifted forwards in time". The other Amy knows what to say and do because, from her perspective, she is repeating what she heard herself say earlier on. The Doctor sends the current Amy into the TARDIS within the current TARDIS, in order to "maintain the timeline". The two Amys take a moment to flirt with each other before the current one departs, much to the Doctor's exasperation. However, not long after the current Amy has left, Rory and Amy enter through the door of outer TARDIS, explaining that the Doctor, from their perspective, just sent them into the inner TARDIS. The current Doctor promptly sends the current Rory and now-current Amy through the inner TARDIS. The Doctor then explains that he will set up a "controlled temporal implosion" in order to "reset the TARDIS", but in order to do so he must know which lever to use on the control panel. Moments after he speaks, another Doctor enters though the outer TARDIS door and tells him to use "the wibbly lever", which he quickly operates, then steps into the inner TARDIS to tell his past self which lever to use. The inner TARDIS dematerialises while the outer TARDIS (being the same TARDIS) does the same, and the Doctor assures Amy and Rory that they are now back in "normal flight", and then advises Amy to "put some trousers on."