#include <bits/stdc++.h>
using namespace std;
int main(void) {
  int n, ma = 0;
  cin >> n;
  vector<int> a(n + 5);
  for (int i = 0; i < n; i++) {
    cin >> a.at(i);
  }
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < n; j++) {
      if (a.at(i) != a.at(j)) {
        ma = max(a.at(j), ma);
      }
    }
    if (ma == 0) {
      cout << a.at(i) << endl;
    } else {
      cout << ma << endl;
    }
    ma = 0;
  }
  return 0;
}
