process.stdin.resume();
process.stdin.setEncoding('utf8');

var stdinLines = [];
var reader = require('readline').createInterface({
  input: process.stdin,
  output: process.stdout
});
reader.on('line', (line) => {
  stdinLines.push(line);
});
reader.on('close', () => {
  const lines = stdinLines.slice(1, stdinLines.length).map(Number);

  const eachMax = lines.map((v, i) => {
    const self_lines = [...lines];
    self_lines.splice(i, 1);
    const max = Math.max(...self_lines);
    return max;
  });

  console.log(eachMax.join("\n"));
});
