#include <bits/stdc++.h>
using namespace std;
const int BLOCK_SIZE = 1000;
const long long INF = 3e18;
struct TQuery {
  int Idx;
  int Type;
  union {
    struct {
      long long A;
      long long B;
    };
    struct {
      int Q;
    };
    struct {
      int EraseIdx;
    };
  };
};
struct TFrac {
  long long P;
  long long Q;
  TFrac() : P(0), Q(1) {}
  void Upd() {
    if (Q < 0) {
      P *= -1;
      Q *= -1;
    }
  }
  TFrac(long long p, long long q) : P(p), Q(q) { Upd(); }
  TFrac(long long p) : P(p), Q(1) {}
  TFrac operator+(const TFrac& f) const {
    return TFrac(P * f.Q + f.P * Q, Q * f.Q);
  }
  bool operator<(const TFrac& f) const { return P * f.Q < f.P * Q; }
  bool operator==(const TFrac& f) const { return P == f.P && Q == f.Q; }
};
struct TLine {
  long long A;
  long long B;
  int Idx;
};
bool operator<(const TLine& a, const TLine& b) {
  return a.A < b.A || (a.A == b.A && a.B < b.B);
}
TFrac Intersect(const TLine& a, const TLine& b) {
  long long A1 = a.A;
  long long B1 = a.B;
  long long A2 = b.A;
  long long B2 = b.B;
  return TFrac(B1 - B2, A2 - A1);
}
bool NeedErase(const TLine& a, const TLine& b, const TLine& c) {
  TFrac x1 = Intersect(a, b);
  TFrac x2 = Intersect(b, c);
  return x2 < x1 || (x2 == x1);
}
void MakeConvexHull(const vector<TLine>& all, int st, int to,
                    const vector<int>& erasedTime, vector<TLine>& convexHull,
                    vector<TLine>& buffer) {
  buffer.clear();
  buffer.reserve(all.size());
  for (int i = 0; i < (int)all.size(); ++i)
    if (all[i].Idx < st && erasedTime[all[i].Idx] >= to)
      buffer.push_back(all[i]);
  convexHull.clear();
  for (const TLine& l : buffer) {
    while (convexHull.size() >= 2 &&
           NeedErase(convexHull[convexHull.size() - 2],
                     convexHull[convexHull.size() - 1], l))
      convexHull.pop_back();
    convexHull.push_back(l);
  }
}
bool Check(const vector<TLine>& convexHull, int m, long long x) {
  TFrac p = Intersect(convexHull[m - 1], convexHull[m]);
  return p < TFrac(x) || p == TFrac(x);
}
long long FindInConvexHull(const vector<TLine>& convexHull, long long x) {
  if (convexHull.empty()) return -INF;
  int l = 0, r = (int)convexHull.size();
  while (r - l > 1) {
    int m = (l + r) / 2;
    if (Check(convexHull, m, x)) {
      l = m;
    } else {
      r = m;
    }
  }
  return 1LL * convexHull[l].A * x + convexHull[l].B;
}
int main() {
  ios_base::sync_with_stdio(false);
  int n;
  cin >> n;
  vector<TQuery> q(n);
  for (int i = 0; i < n; ++i) {
    cin >> q[i].Type;
    q[i].Idx = i;
    switch (q[i].Type) {
      case 1:
        cin >> q[i].A >> q[i].B;
        break;
      case 2:
        cin >> q[i].EraseIdx;
        --q[i].EraseIdx;
        break;
      case 3:
        cin >> q[i].Q;
        break;
    }
  }
  vector<TLine> lines;
  lines.reserve(n);
  for (int i = 0; i < n; ++i)
    if (q[i].Type == 1) lines.push_back(TLine{q[i].A, q[i].B, q[i].Idx});
  sort(lines.begin(), lines.end());
  vector<int> erasedTime(n, n);
  for (int i = 0; i < n; ++i)
    if (q[i].Type == 2) erasedTime[q[i].EraseIdx] = i;
  vector<TLine> convexHull;
  vector<TLine> buffer;
  vector<long long> answer;
  answer.reserve(n);
  for (int st = 0; st < n; st += BLOCK_SIZE) {
    int to = min(n, st + BLOCK_SIZE);
    MakeConvexHull(lines, st, to, erasedTime, convexHull, buffer);
    for (int i = st; i < to; ++i) {
      if (q[i].Type == 3) {
        long long currentAnswer = -INF;
        for (int j = st; j < to; ++j) {
          if (q[j].Type == 1)
            if (j < i && erasedTime[j] > i)
              currentAnswer =
                  max(currentAnswer, 1LL * q[j].A * q[i].Q + q[j].B);
          if (q[j].Type == 2)
            if (q[j].EraseIdx < i && j > i)
              currentAnswer =
                  max(currentAnswer,
                      1LL * q[q[j].EraseIdx].A * q[i].Q + q[q[j].EraseIdx].B);
        }
        currentAnswer =
            max(currentAnswer, FindInConvexHull(convexHull, q[i].Q));
        answer.push_back(currentAnswer);
      }
    }
  }
  for (int i = 0; i < (int)answer.size(); ++i) {
    if (answer[i] == -INF) {
      cout << "EMPTY SET" << '\n';
    } else {
      cout << answer[i] << '\n';
    }
  }
  return 0;
}
