* Line 1: A single line containing N, M and Q separated by a space.
* Lines 2..1+M: Line i+1 indicates the position from the top, P[i], of
the i-th card in the Bessie-shuffle (1 <= P[i] <= M).
* Lines 2+M..1+M+Q: Line i+1+M contains a single integer q_i
describing the i-th query. You are to compute the label on
the card located in position q_i from the top (1 <= q_i <= N).
* Lines 1..Q: On the i-th line, print a single integer indicating the
card at position q_i from the top.
INPUT DETAILS:
Bessie has a deck of 5 cards initially ordered as [1, 2, 3, 4, 5]. Her
shuffle is on 3 cards and has the effect of moving the top card to the
bottom. There are 5 queries querying each position in the deck.
OUTPUT DETAILS:
The shuffle proceeds as:
[1, 2, 3, 4, 5] -> [2, 3, 1, 4, 5] (put 2 face down)
[3, 1, 4, 5] -> [1, 4, 3, 5] (put 1 face down)
[4, 3, 5] -> [3, 5, 4] (put 3 face down)
[5, 4] (put 5 face down)
[4] (put 4 face down)
This produces the final order of [4, 5, 3, 1, 2]