#include <bits/stdc++.h>
using ll = unsigned long long;
using namespace std;
int main() {
  int n;
  cin >> n;
  vector<int> a(n);
  for (int i = 0; i < (n); i++) cin >> a[i];
  int t;
  vector<int> b(n);
  for (int i = 0; i < (n); i++) {
    b = a;
    t = b[i];
    b[i] = 0;
    sort(b.begin(), b.end());
    cout << b[n - 1] << "\n";
  }
  return 0;
}
