Given a pile of n cards numbered from 1 to n with card 1 at the top and card n at the bottom. The following operation is performed while you have 2 or more cards in the pile.
Discard the top card and move the next card (the one on top) to the bottom of the pile.
Your task is to find the sequence of discarded cards and the last remaining card.
Each input line (except the last) contains a number n ≤ 50. The last line contains 0 and must not be processed. Each input number produces two lines of output. The first row shows the sequence of discarded cards and the second row shows the remaining card.
Input
The input consists of an indeterminate number of lines each containing a value from 1 to 50. The last line contains the value 0.
Exit
For each test case, print two lines. The first line presents the sequence of discarded cards, each one separated by a comma and a space. The second line shows the number of the remaining card. No lines have extra spaces at the beginning or end. See example to check the expected format.
Input Example Output Example
7
19
10
6
0
Discarded cards: 1, 3, 5, 7, 4, 2
Remaining card: 6
Discarded cards: 1, 3, 5, 7, 9, 11, 13, 15, 17, 19, 4, 8, 12, 16, 2, 10, 18, 14
Remaining card: 6
Discarded cards: 1, 3, 5, 7, 9, 2, 6, 10, 8
Remaining card: 4
Discarded cards: 1, 3, 5, 2, 6
Remaining card: 4