'use strict'
const main = input => {
  const n = parseInt(input[0], 10)
  input.shift();
  const a = input.map(val => parseInt(val, 10));
  a.pop();
  // console.log(n, a);
  for(let i=0; i<n; i++) {
    let array = [...a];
    array.splice(i, 1)
    // console.log(array);
    array.sort((x,y) => x>y?-1:1);
    console.log(array[0]);    
  }
}
main(require("fs").readFileSync("/dev/stdin", "utf8").split('\n'));