#include <bits/stdc++.h>
int main() {
  int N;
  std::cin >> N;
  int max;
  std::vector<int> Ai;
  for (int i = 0; i < N; i++) {
    int temp;
    std::cin >> temp;
    Ai.push_back(temp);
  }
  max = Ai[0];
  for (int i = 1; i < N; i++) {
    if (Ai[i] > max) max = Ai[i];
    std::cout << max << std::endl;
  }
  return 0;
}
