#include <bits/stdc++.h>

using namespace std;

int main() {
    ifstream in("prizes.in");
    ofstream out("prizes.out");
    int n;
    in >> n;
    vector<int> a(n);
    in >> a[0];
    for (int i = 1; i < n; i++) {
        in >> a[i];
    	sort(a.begin(), a.begin() + i + 1);
        out << a[i - 1] << " ";
    }
    return 0;
}
