#include <bits/stdc++.h>
using namespace std;

#define range(i, l, r) for (int i = (int)l; i < (int)(r); ++(i))
#define rrange(i, l, r) for (int i = ((int)(r) - 1); i >= (int)l; --(i))

#define whole(f,x,...) ([&](decltype((x)) whole) { return (f)(begin(whole), end(whole), ## __VA_ARGS__); })(x)
#define rwhole(f,x,...) ([&](decltype((x)) whole) { return (f)(rbegin(whole), rend(whole), ## __VA_ARGS__); })(x)

#define debug(x) cerr << "(" << __LINE__ << ")" << #x << ": " << (x) << endl

using int32 = int;
using int64 = long long;

const int mod     = 1e9 + 7;
const int32 inf   = 1001001001;
const int64 infll = 1001001001001001001ll;

const int dx[] = {0, -1, 1, 0, -1, 1, -1, 1}, dy[] = {-1, 0, 0, 1, -1, -1, 1, 1};
const string YES = "YES", NO = "NO", Yes = "Yes", No = "No", yes = "yes", no = "no";

struct IoSetup { IoSetup(){ cin.tie(0); ios::sync_with_stdio(0); cout << fixed << setprecision(16); cerr << fixed << setprecision(16); } } iosetup;

template <typename T = int64> T input() { T x; cin >> x; return x; }

template <typename T> ostream &operator<<(ostream &os, vector<T> &v) { range(i, 0, v.size()) { os << v[i] << (i + 1 != v.size() ? " " : ""); } return os; } 
template <typename T> istream &operator>>(istream &is, vector<T> &v) { for (T &in : v) is >> in; return is; }
template <typename T1, typename T2> ostream &operator<<(ostream &os, pair<T1, T2> p) { os << p.fs << " " << p.sc; return os; }
template <typename T1, typename T2> istream &operator>>(istream &is, pair<T1, T2> &p) { is >> p.fs >> p.sc; return is; }

template <typename T> vector<T> make_v(size_t a, T b) { return vector<T>(a, b); }
template <typename... Ts> auto make_v(size_t a, Ts... ts) { return vector<decltype(make_v(ts...))>(a, make_v(ts...)); }

template <typename T1, typename T2> inline bool chmax(T1 &a, T2 b) { return a < b && (a = b, true); }
template <typename T1, typename T2> inline bool chmin(T1 &a, T2 b) { return a > b && (a = b, true); }

void solver() {
  int Q = input();

  priority_queue< int64 > lhs;
  priority_queue< int64, vector< int64 >, greater< int64 > > rhs;
  int64 lhs_sum = 0, rhs_sum = 0, b_sum = 0;

  range(i, 0, Q) {
    int com;
    cin >> com;

    if (com == 1) {
      int64 a = input(), b = input();
      b_sum += b;

      if (i == 0 || lhs.top() > a) {
        lhs.push(a);
        lhs_sum += a;

        if (lhs.size() == rhs.size() + 2) {
          rhs_sum += lhs.top();
          lhs_sum -= lhs.top();

          rhs.push(lhs.top());
          lhs.pop();
        }
      } else {
        if (rhs.size() == 0 || rhs.top() < a) {
          rhs.push(a);
          rhs_sum += a;

          if (rhs.size() > lhs.size()) {
            lhs_sum += rhs.top();
            rhs_sum -= rhs.top();
            lhs.push(rhs.top());
            rhs.pop();
          }
        } else {
          lhs.push(a);
          lhs_sum += a;
          
          if (lhs.size() == rhs.size() + 2) {
            rhs_sum += lhs.top();
            lhs_sum -= lhs.top();
  
            rhs.push(lhs.top());
            lhs.pop();
          }
        }
      }
    }
    else {
      cout << lhs.top() << " " << (int64)lhs.size() * lhs.top() - lhs_sum + rhs_sum - (int64)rhs.size() * lhs.top() + b_sum << endl;
    }

  }
}

signed main(int argc, char *argv[]) {
  solver();
}


Measured memory_bytes: 3828