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