<?php
  
while ($line = fgets(STDIN)) {
   $stdin[] = trim($line);
}
#$v2 = str_split($stdin[0]);
#$v2 = explode(" ", $stdin[0]);

#var_dump($stdin);

foreach($stdin as $k => $v){
  if($k == 0){ continue; }
  $array = array();
  for($i = 1; $i < count($stdin); $i++){
    if($k == $i){ continue; }
    $array[] = $stdin[$i];
  }
  $ans .= max($array) . PHP_EOL;
}
  





echo $ans . PHP_EOL;