#include<stdio.h>
int main(){
int card[51];
int n;
while (scanf("%d", &n)!=EOF && n!=0) {
int i;
for (i=1; i<=n; i++){
card[i]=i;
}
int amount=n;
printf("Discarded cards: ");
if (n==1) {
printf("\nRemaining card: 1\n");
continue;
}
while (amount>1) {
if (amount!=n) printf(", ");
printf("%d", card[1]);
card[1]=0;
int swit=card[2];
for (i=1; i<amount; i++){
card[i]=card[i+2];
}
card[amount-1]=swit;
amount--;
}
printf("\nRemaining card: %d\n", card[i]);
}
return 0;
}