#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, ans;
  cin >> n;
  vector<int> a(n);
  for (int i = 0; i < (int)n; i++) {
    cin >> a.at(i);
  }
  cout << endl;
  for (int i = 0; i < (int)n; i++) {
    if (n == 2) {
      if (i == 0)
        ans = a.at(1);
      else
        ans = a.at(0);
    } else if (n == 3) {
      if (i == 0)
        ans = max(a.at(1), a.at(2));
      else if (i == 1)
        ans = max(a.at(0), a.at(2));
      else if (i == 2)
        ans = max(a.at(0), a.at(1));
    } else if (n == 4) {
      if (i == 0)
        ans = max(a.at(1), max(a.at(2), a.at(3)));
      else if (i == 1)
        ans = max(a.at(0), max(a.at(2), a.at(3)));
      else if (i == 2)
        ans = max(a.at(0), max(a.at(1), a.at(3)));
      else if (i == 3)
        ans = max(a.at(0), max(a.at(1), a.at(2)));
    }
    cout << ans << endl;
  }
  return 0;
}
