#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  cin >> n;
  vector<vector<int>> a(n, vector<int>(n));
  int tmp;
  for (int i = 0; i < n; ++i) {
    cin >> tmp;
    for (int j = 0; j < n; ++j) a[i][j] = tmp;
    a[i][i] = 0;
  }
  for (int j = 0; j < n; ++j) {
    int imax = 0;
    for (int i = 0; i < n; ++i) imax = max(a[i][j], imax);
    cout << imax << endl;
  }
  return 0;
}
