import Data.List
import qualified Data.ByteString.Char8 as B
import Data.Ord

main :: IO ()
main = getLine >> breads >>= putStrLn . unlines . fmap (unwords . fmap show) . solve

solve :: [Int] -> [[Int]]
solve xs
    | minv >= 0 = [l - 1] : build1 1
    | maxv <= 0 = [l - 1] : build2 l
    | maxv > abs minv = [2 * l - 1] : build3
    | otherwise = [2 * l - 1] : build4
    where
        l = length xs
        (minv, mini) = minimumBy (comparing fst) $ zip xs [1..]
        (maxv, maxi) = maximumBy (comparing fst) $ zip xs [1..]

        build1 y
            | y < l = [y, y + 1] : build1 (y + 1)
            | otherwise = []
        build2 y
            | y > 1 = [y, y - 1] : build2 (y - 1)
            | otherwise = []
        build3 = [[maxi, y] | y <- [1..l]] `mappend` build1 1
        build4 = [[mini, y] | y <- [1..l]] `mappend` build2 l



breads :: IO [Int]
breads = unfoldr uff <$> B.getLine
    where
        uff b = check <$> B.readInt b
        check (a, b)
            | B.null b = (a, b)
            | otherwise = (a, B.tail b)