#include <cstdio> #include <queue> using namespace std;  int main() { 	queue<int> deck; 	int n, x;  	while (true) { 		scanf("%d", &n); //input n 		if (n==0) //jika input = 0 maka program berhenti 			break; 		 		//inputkan 1 sampai n kartu ke queue 		for (int i = 1; i <= n; i++) { 			deck.push(i); 		} 		 		//cetak kartu yang dibuang 		printf("Discarded cards:"); 		while (deck.size()>1) { 			printf(" %d", deck.front()); 			deck.pop(); 			x = deck.front(); 			deck.pop(); 			if (!deck.empty()) 				printf(","); 			deck.push(x); 		} 		//cetak kartu yang tersisia 		printf("\nRemaining card: %d\n", deck.front()); 		deck.pop(); 	}  	return 0; }