#include <bits/stdc++.h>
using namespace std;
int main() {
  ios::sync_with_stdio(false);
  cin.tie(nullptr);
  cout.tie(nullptr);
  long long int n;
  cin >> n;
  vector<long long int> v(n);
  for (long long int i = 0; i < n; i++) cin >> v[i];
  for (long long int i = 0; i < n; i++) {
    v[i] = -1 * v[i];
    cout << *max_element(v.begin(), v.end()) << "\n";
    v[i] = -1 * v[i];
  }
  return 0;
}
