#include<bits/stdc++.h>
using namespace std;
long long n;
queue <ll> dhf;
int main()
{
cin>>n;
for(ll i=1;i<=n;i++){
ll in;
cin>>in;
dhf.push(in);
}
for(ll i=1;i<=n;i++){
cout<<"======que size="<<dhf.size()<<"======\n";
cout<<" que.front="<<dhf.front()<<endl;
dhf.pop();
}
return 0;
}
// 队列练习1
#include<bits/stdc++.h>
using namespace std;
long long n;
priority_queue <ll> dhf;
int main()
{
cin>>n;
for(ll i=1;i<=n;i++){
ll in;
cin>>in;
dhf.push(in);
}
while(dhf.size()){
cout<<"=========q.size = ["<<dhf.size()<<"]==========\n";
cout<<" top = "<<dhf.top()<<endl;
dhf.pop();
}
return 0;
}
//队列练习2
#include<bits/stdc++.h>
using namespace std;
long long n,k,x=1;
queue <ll> dhf;
int main()
{
cin>>n>>k;
for(ll i=1;i<=n;i++) dhf.push(i);
while(dhf.size()){
if(x==k){
cout<<dhf.front()<<" ";
dhf.pop();
x=1;
}
else{
x++;
dhf.push(dhf.front());
dhf.pop();
}
}
return 0;
}
// 约瑟夫问题
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
ll n,k,x=1;
queue <ll> dhf;
int main()
{
cin>>n>>k;
for(ll i=1;i<=n;i++) dhf.push(i);
while(dhf.size()){
if(x==k){
cout<<dhf.front()<<" ";
dhf.pop();
x=1;
}
else{
x++;
dhf.push(dhf.front());
dhf.pop();
}
}
return 0;
}
//约瑟夫的杀人计划