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

var lines = []
var reader = require('readline').createInterface({
  input: process.stdin,
  output: process.stdout
});

reader.on('line', (line) => {
  lines.push(line);
});

reader.on('close', () => {
 var n = Number(lines[0]);
 var a = [];
 var count = 0;
 for(i=1; i<=n; i++){
   for(j=1; j<=n; j++){
     if(i === j){
       continue;
     }
     a.push(lines[j]);   
   }
   // var max = array.sort((a, b)=> b - a)[0];
   console.log(Math.max(...a));
   a = [];
 }

 
});