#includeusing namespace std;struct Node{ int num; Node *next; Node(){next=NULL;}};int main(){ int n,N; cin>>N; while(N--) { cin>>n; int i,size=n; Node* head,*start; head=new Node; start=head; head->num=1; for(i=0;i next=new Node; head=head->next; head->num=i+2; } while(size>3) { Node *prev=start; head=start->next; for(i=1;i next=head->next; delete head; head=prev->next; size--; } else { prev=head; head=head->next; } } if(size<=3) break; int count; prev=start; head=start->next; for(i=1,count=1;i next=head->next; delete head; head=prev->next; size--; count=0; } else { prev=head; head=head->next; } } } cout< num; for(head=start->next;head!=NULL;head=head->next) cout<<' '< num; cout<