#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  cin >> n;
  int a[n];
  (i) for (int(i) = 0; (i) < n; ++(i))(i) cin >> a[i];
  (i) for (int(i) = 0; (i) < n; ++(i))(i) {
    int res = 0;
    (i) for (int(i) = 0; (i) < n; ++(i))(j) {
      if (i != j) {
        res = max(res, a[j]);
      }
    }
    cout << res << endl;
  }
  return 0;
}
