#include <iostream>
#include <vector>
#include <cstdio>
#include <string>
#include <algorithm>
#include <cmath>
using namespace std;
typedef unsigned long ulint;
const int mod = 2019;

int main() {
    int n;
    cin >> n;
    int a[n];
    for (int i = 0; i < n; i++)
    {
        cin >> a[i];
    }
    for (int i = 0; i < n; i++)
    {
                    int tmp = 0;
        for (int j = 0; j < n; j++)
        {

            if (j != i)
            {
                tmp = max(tmp, a[j]);
            }
        }
        cout << tmp << endl;
    }