#include <iostream>
#include <cstdio>
#include <algorithm>
#include <set>
#include <string>
#include <sstream>
#include <vector>
#include <map>
using namespace std;
int main()
{
//freopen("c:\\test.txt","r",stdin);
//freopen("c:\\h.txt","w",stdout);
vector<int> card;
int n;
while(cin>>n&&n)
{
int cnt=0;
for(int i=0;i<n;i++)
card.push_back(i+1);
if(n==1)
cout<<"Discarded cards:";
else
cout<<"Discarded cards: ";
for(vector<int>::size_type i=card.size();i>1;i--) //当牌数大于1张的时候
{
if(card.size()>2)
cout<<*card.begin()<<", ";
else
cout<<*card.begin(); //输出第一张
card.erase(card.begin()); //删除第一张
int temp=*card.begin(); //记录此时第一张牌(就是原来牌堆的第二张)
card.push_back(temp); //加到vector最后
card.erase(card.begin()); //删除第一张(就是原来牌堆的第二张放到最后)
}
cout<<endl;
cout<<"Remaining card: "<<*card.begin()<<endl; //输出最后一张(最后剩下的一张)
card.clear();
}
return 0;
}