#include <iostream> #include<stack> using namespace std; stack<int> help; stack<int>st; int main() { int n; int m; cin>>n; for(int i=0;i<n;i++) { cin>>m; st.push(m); } while(!st.empty()) { int cur=st.top(); st.pop(); while(!help.empty()&&cur<help.top()){ st.push(help.top()); help.pop(); } help.push(cur); } while(!help.empty()) { m=help.top(); help.pop(); cout<<m<<" "; } } // 64 位输出请用 printf("%lld")