Ancient Fractal

Jojo found a fractal art made by ancient civilization, which can be seen in the illustration
below. In order to preserve the art, he decided to make an algorithm to generate the
fractal. During his research, here is what he found about the fractal. The fractal consists
of infinitely many horizontal segments, which are numbered by integers started from 1.
The i-th segment is represented by the range [XL[i], XR[i]], where XL[i] and XR[i] are
integers, and XL[i] ≤ XR[i].
Here is the algorithm Jojo invented to construct the fractal. The fractal starts with the
first segment XL[1] = XR[1] = 1. Then, for every iteration, it follows these steps:
• Supposed that segment 1 to K have been generated by the previous iteration.
• First, add (K + 1)-th segment where XL[K + 1] = 1 and XR[K + 1] = K + 1.
• Then, the next K segments are the translation of the first K segments. Formally,
for all segment i where 1 ≤ i ≤ K, add (K +1+i)-th segment where XL[K +1+i] =
XL[i] + K and XR[K + 1 + i] = XR[i] + K.
At first, there is only segment 1. After the first iteration, there will be 1 + 1 + 1 = 3
segments. After the second iteration, there will be 3 + 1 + 3 = 7 segments. After the
third iteration, there will be 7+1+7 = 15 segments. By repeating the iteration infinitely
many times, the whole fractal can be created.
Unfortunately, Jojo struggles with the implementation. He asked you to create a program
which can output the fractal art. Since it is impossible to create a program which output
infinitely many segments, Jojo only asked you to output XL[i] and XR[i] for all segments
i where A ≤ i ≤ B.
The following illustration is the step by step of creating the segments from the second
iteration to the third iteration