#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const int INF = 1001001001;
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++) {
    vector<int> now = a;
    now[i] = 0;
    sort(now.begin(), now.end());
    cout << now[n - 1] << endl;
  }
  return 0;
}
