import Control.Monad
import Data.List
import Data.Maybe
import Data.Ord
import qualified Data.ByteString.Char8 as BS

main = do
    n <- readLn :: IO Int
    an <- map read <$> replicateM n getLine :: IO [Int]
    let ms = take 2 (sortBy (comparing (\a -> (- (abs a)))) an)
    mapM_ print (map (\x -> if x == ms!!0 then ms!!1 else ms!!0) an)
    