#include <bits/stdc++.h>
int main() {
  int num;
  std::cin >> num;
  std::vector<int> vec(num, 0);
  for (auto& v : vec) {
    std::cin >> v;
  }
  for (auto i = 0; i < num; i++) {
    auto v = vec;
    v.at(i) = -std::numeric_limits<int>::infinity();
    std::cout << *std::max_element(v.begin(), v.end()) << std::endl;
  }
  return 0;
}
