import scala.io.{StdIn => in}
import scala.collection.{mutable => mu}

object Main extends App {
  val n = in.readInt
  val a = in.readLine.split(" ").map(_.toInt)

  val max = a.max
  val min = a.min

  val buf = StringBuilder.newBuilder
  if(max == 0 && min == 0) buf.append(0).append('\n')
  else if(min >= 0) {
    (1 until n).foreach(i => buf.append(i).append(' ').append(i+1).append('\n'))
  }
  else if(max < 0) {
    (n-1 to 1 by -1).foreach(i => buf.append(i+1).append(' ').append(i).append('\n'))
  } else {
    val m = if(max.abs > min.abs) max else min
    val idx = a.indexWhere(_ == m)
    for(i <- 0 until n if i != idx){
      buf.append(m+1).append(' ').append(i+1).append('\n')
    }
    val b = a.map(_ + m)
    if(m >= 0)
      (1 until n).foreach(i => buf.append(i).append(' ').append(i+1).append('\n'))
    else
      (n-1 to 1 by -1).foreach(i => buf.append(i+1).append(' ').append(i).append('\n'))
  }

  print(buf)
}