Theory of gateway in case of time travel