import java.io._
import java.util.StringTokenizer
import scala.util.control.Breaks.{breakable,break}

object Main extends App {
  val in = new InputReader(System.in)
  val pw = new PrintWriter(System.out)

  val Q = in.next().toInt
  var stack: List[Int] = Nil
  var elem = -1
  var sum = 0L
  var hoge = 0L
  var (minus, zero, plus) = (0, 0, 0)

  for (_ <- 0 until Q) {
    val com = in.next().toInt

    if (com == 1) {
      val a, b = in.next().toInt
      sum += b
      hoge += a.abs
      if (a > 0)
        plus += 1
      else if (a == 0)
        zero += 1
      else
        minus += 1

      stack = a :: stack
      elem += 1
    }
    else {
      val now = stack.sorted.toArray
      val mid = now(elem / 2).toLong

      var ans = sum + hoge
      
      if (mid > 0)
        ans += mid * (minus - plus + zero)
      else if (mid < 0)
        ans += mid.abs * (plus - minus + zero)

      pw.println(s"$mid $ans")
    }
  }

  pw.flush()
}


class InputReader(stream: InputStream) {
  private val reader = new BufferedReader(new InputStreamReader(stream))
  private var tokenizer: StringTokenizer = new StringTokenizer(reader.readLine())
  def next(): String = {
    while (!tokenizer.hasMoreTokens()) {
      tokenizer = new StringTokenizer(reader.readLine())
    }
    tokenizer.nextToken()
  }
}
