#include <bits/stdc++.h>
using namespace std;
using Graph = vector<vector<int64_t>>;
const double pi = M_PI;
const int64_t MOD = 1000000007;
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> tem(a);
    tem[i] = 0;
    auto ans = max_element(tem.begin(), tem.end());
    cout << *ans << endl;
  }
  return 0;
}
