#include <bits/stdc++.h>
int main() {
  int n;
  std::cin >> n;
  std::vector<int> a(n);
  int i = 0;
  for (int i = 0; i < n; ++i) {
    std::cin >> a.at(i);
  }
  for (int i = 0; i < n; ++i) {
    std::vector<int> b(a);
    b.at(i) = 0;
    std::cout << *std::max_element(b.begin(), b.end()) << std::endl;
  }
  return 0;
}
