Give you n linklists, each with m numbers inside. the chains index are numbered 0 to (n-1), and the nodes on the initial i-th chain are numbered (i*m) , (i*m+1) ...... (i*m+(m-1))
After that you are given k operations, each operation will select two node numbers a,b. Disconnect the right side of a and the left side of b on the current linklist into four parts, then join a and b together and join the remaining two disconnected parts together.
For example, n=3,m=5. If you choose a,b=1,7 then the result after reconnection is [5,6,2,3,4] and [0,1,7,8,9]
After these operations, ask for all the nodes of the linklist where node x is located and output them from left to right.