#include <bits/stdc++.h>
using namespace std;
int n,k;
int a[1000000],b[1000000],i=1,sum=0,gtln=INT_MIN;
int freq[1000000];
string s;
int d=0,dem=0;
int main()
{
    freopen("CAU2_16.inp","r",stdin);
    freopen("CAU2_16.out","w",stdout);
    cin>>n;
    for (int i=0;i<n;i++)
    {
        cin>>a[i];
        gtln=max(gtln,a[i]);
        cout<<gtln<<" ";
    }
}
