#include <bits/stdc++.h>
using namespace std;
vector<int> vc;
const int N = 10E4;
int arr[N];
int main() {
  int n;
  cin >> n;
  int maxi = 0;
  for (int i = 0; i < n; i++) cin >> arr[i];
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < n; j++) {
      if (i != j) maxi = max(arr[j], maxi);
    }
    vc.push_back(maxi);
    maxi = 0;
  }
  for (auto x : vc) cout << x << endl;
  return 0;
}
