#include <bits/stdc++.h>
#define pb push_back
#define ll long long
#define si short int
#define speed ios_base::sync_with_stdio(0),cin.tie(0),cout.tie(0)
#define pill pair<ll,ll>
#define f first
#define s second
#define pilc pair<ll,char>
#define all(a) (a).begin(),(a).end()
#define rep(s,e,step) for(int i = (s); i < (e) ; i += step)
#define vrep(s,e,step) for(int j = (s); j < (e) ; j += step)
#define ex exit(0)
#define sz(a) (a).size()
#define triple pair<ll,pill>
#define ld long double

using namespace std;

const ll N = 1;
const ll big = 1e18;
const ll block = 800;
const ll mod = 1e6;

ll n;

set<pill> a;

vector<triple> x;

multiset<pill> cht;

ld cross(pill a,pill b){
	if(a.f == b.f)
		return big;
	return ((b.s - a.s) / (b.f - a.f));
}

int main() {
    speed;
    cin >> n;	// Верно
    rep(0, n, 1) {// Верно
    	ll t, a, b = 0;// Верно
    	cin >> t >> a;// Верно
    	if(t == 1) // Верно
    		cin >> b;// Верно
		x.pb({t, {a, b}});// Верно
	}
	ll blocks = 1;// Верно

	for(int i = 0; i < n; i += block) {// Верно
		ll y = i;// Верно
		multiset<pill> bruh;// Верно
		ll r = min(n, y + block);// Верно
		for(int j = y; j < r; j++) {// Верно
			if(x[j].f == 2){// Верно
				ll hm = x[j].s.f - 1;// Верно
				pill amir = x[hm].s;// Верно
				if(hm < y){// Верно
					bruh.insert(amir);// Верно
					auto it = cht.find(amir);// Верно
					cht.erase(it);// Верно
				}// Верно
			}// Верно
		}// Верно
		// Неизвестно
		vector<pill> convex;
		for(auto u : cht) {
			while(convex.size() > 1 && cross(convex[convex.size() - 2],u) >= cross(convex.back(), u))
				convex.pop_back();
			convex.pb(u);
		}
		// Неизвестно
		for(int j = y; j < r; j++) {
			if(x[j].f == 1){
				bruh.insert(x[j].s);// Верно
				cht.insert(x[j].s);// Верно
			}
			if(x[j].f == 2){
				ll hm = x[j].s.f - 1;// Верно
				pill amir = x[hm].s;// Верно
				auto it = bruh.find(amir);// Верно
				bruh.erase(it);// Верно
				it = cht.find(amir);// Верно
				cht.erase(it);// Верно
			}
			if(x[j].f == 3) {
				if(bruh.size() == 0 && convex.size() == 0){// Верно
					cout << "EMPTY SET\n";// Верно
					continue;// Верно
				}// Верно
				ll ans = -big;
				for(auto u : bruh) {// Верно
					ans = max(u.f * x[j].s.f + u.s, ans);// Верно
				}// Верно
				if(convex.size() > 0){
					ans = max(convex[0].f * x[j].s.f + convex[0].s, ans);
					ll l = 1, r = convex.size() - 1;
					while(l <= r) {
						ll m = (l + r) / 2;
						ld con = cross(convex[m - 1], convex[m]);
						if(con <= x[j].s.f)
							l = m + 1, ans = max(convex[m].f * x[j].s.f + convex[m].s, ans);
						else
							r = m - 1;
					}
				}
				cout << ans << '\n';
			}
		}
	}

}

/*
x
*/


#pragma GCC optimize("Ofast,no-stack-protector,unroll-loops,fast-math,O3")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#include <bits/stdc++.h>
#define pb push_back
#define ll long long
#define si short int
#define speed ios_base::sync_with_stdio(0),cin.tie(0),cout.tie(0)
#define pill pair<ll,ll>
#define f first
#define s second
#define pilc pair<ll,char>
#define all(a) (a).begin(),(a).end()
#define rep(s,e,step) for(int i = (s); i < (e) ; i += step)
#define vrep(s,e,step) for(int j = (s); j < (e) ; j += step)
#define ex exit(0)
#define sz(a) (a).size()
#define triple pair<ll,pill>
#define ld long double
#define F first
#define S second.first
#define T second.second

using namespace std;

const ll N = 1;
const ll big = 6e18;
ll block = 800;
const ll mod = 1e6;

ll n;

set<pill> a;

vector<triple> t;

set<triple> cht;

vector<pill> convex;

ld cross(pill a,pill b){
    return (b.s - a.s + 0.0) / (a.f - b.f + 0.0);
}

void add(pill a) {
	ll z = convex.size() - 1;;
	while(convex.size() >= 2 && cross(convex[z - 1], a) >= cross(convex[z], convex[z - 1]))
		convex.pop_back(), z--;
	convex.push_back({a});
}

int main() {
    speed;
    cin >> n;
    t.pb({0, {0, 0}});
    rep(0, n, 1) {
    	ll x, a, b = 0;
    	cin >> x >> a;
    	if(x == 1)
    		cin >> b;
		t.pb({x, {a, b}});
	}
	block = 4950;

	for(int i = 1; i <= n; i += block) {
		ll l = i, r = min(i + block, n + 1);

		set<triple> sub;

		for(int j = l; j < r; j++) {
			if(t[j].F == 2 && t[j].S < l) {
				triple del = {t[t[j].S].S, {t[t[j].S].T, t[j].S}};
				auto it = cht.find(del);
				cht.erase(it);
				sub.insert(del);
			}
		}
		for(auto u : cht)
			add({u.F,u.S});
		for(int j = l; j < r; j++) {
			if(t[j].F == 1) {
				cht.insert({t[j].S, {t[j].T, j}});
				sub.insert({t[j].S, {t[j].T, j}});
			}
			if(t[j].F == 2) {
				ll L = t[j].S;
				triple del = {t[L].S, { t[L].T, L}};
				auto it = sub.find(del);
				sub.erase(it);
				if(L >= l) {
					it = cht.find(del);
					cht.erase(it);
				}
			}
			if(t[j].F == 3) {
				ll ans = -big;
				if(sub.size() == 0 && cht.size() == 0) {
					cout << "EMPTY SET\n";
					continue;
				}
				ll x = t[j].S;
				for(auto u : sub)
					ans = max(ans, u.F * x + u.S);
				if(convex.size() > 0) {
					ll L = 1, R = convex.size() - 1;
					ans = max(convex[0].f * x + convex[0].s, ans);
					ld XX = x;
					while(L <= R) {
						ll m = (L + R) >> 1;
						ans = max(convex[m].f * x + convex[m].s, ans);
						if(cross(convex[m], convex[m - 1]) > XX)
							R = m - 1;
						else
							L = m + 1;
					}
				}
				cout << ans << '\n';
			}
		}

		convex.clear();
	}

}

/*
x
*/


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

#define F first
#define S second
#define mp make_pair
#define pb push_back
#define pf push_front
#define speed_up ios_base::sync_with_stdio(0),cin.tie(0),cout.tie(0)
#define sz(x) (int)x.size()
#define all(x) x.begin(), x.end()
#define debug cerr << "OK\n";
#define ub upper_bound
#define lb lower_bound

namespace io {
	const int __SIZE = (1 << 21) + 1;
	char ibuf[__SIZE], *iS, *iT, obuf[__SIZE], *oS = obuf, *oT = oS + __SIZE - 1, __c, qu[55]; int __f, qr, _eof;
	#define Gc() (iS == iT ? (iT = (iS = ibuf) + fread (ibuf, 1, __SIZE, stdin), (iS == iT ? EOF : *iS++)) : *iS++)
	inline void flush () { fwrite (obuf, 1, oS - obuf, stdout), oS = obuf; }
	inline void gc (char &x) { x = Gc(); }
	inline void pc (char x) { *oS ++ = x; if (oS == oT) flush (); }
	inline void pstr (const char *s) {int __len = strlen(s); for (__f = 0; __f < __len; ++__f) pc (s[__f]); }
	inline void gstr (char *s) {  for(__c = Gc(); __c < 32 || __c > 126 || __c == ' ';)  __c = Gc();
		for(; __c > 31 && __c < 127 && __c != ' '; ++s, __c = Gc()) *s = __c; *s = 0;}
	template <class I> inline bool gi (I &x) { _eof = 0;
		for (__f = 1, __c = Gc(); (__c < '0' || __c > '9') && !_eof; __c = Gc()) { if (__c == '-') __f = -1; _eof |= __c == EOF; }
		for (x = 0; __c <= '9' && __c >= '0' && !_eof; __c = Gc()) x = x * 10 + (__c & 15), _eof |= __c == EOF; x *= __f; return !_eof; }
	template <class I> inline void gp (I x) { if (!x) pc ('0'); if (x < 0) pc ('-'), x = -x;
		while (x) qu[++ qr] = x % 10 + '0',  x /= 10; while (qr) pc (qu[qr --]); }
	struct Flusher_ {~Flusher_(){flush();}}io_flusher_;
} using io::pc; using io::gc; using io::pstr; using io::gstr; using io::gi; using io::gp;

void scan() {
	return;
}

template<class T, typename... Args>
void scan(T &a, Args&&... args) {
	gi(a);
	scan(args...);
	return;
}

template<typename T>
void scann(T a, T b) {
	for (auto it = a; it != b; ++it)
		scan(*it);
}

template<typename T>
void scerr(T a, T b) {
	for (auto it = a; it != b; ++it)
		cerr << *it << " ";
	cerr << '\n';
}

void print() {
	pc('\n');
	return;
}

template<class T, typename... Args>
void print(T a, Args... args) {
	gp(a);
	pc(' ');
	print(args...);
	return;
}

void cer() {
	return;
}

template<class T, typename... Args>
void cer(T a, Args... args) {
	cerr << a << " ";
	cer(args...);
	return;
}

typedef long long ll;
typedef long double ld;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef vector<pii> vpii;
typedef set <int> si;
typedef set <ll> sll;
typedef multiset <int> msi;
typedef multiset <ll> msll;
typedef map <int, int> mi;
typedef map <ll, int> mll;

const int N = 3e5 + 2;
const int M = 4e6 + 2;
const ll mod = 1e9 + 7;
const int inf = 2e9 + 3;
const ll INF = 3e18;

void data() {
	#ifdef PC
		freopen("main.in", "r", stdin);
		freopen("main.out", "w", stdout);
	#endif
}

ll n, block = 300000, cnt = 1, is[N];
vector <pll> lines, del;
vector <pair <pll, pll>> qu[N], temp, all_l;

pair <pll, pll> q[N];

ld cross(pll a, pll b) {
	return (b.S - a.S + 0.0) / (a.F - b.F + 0.0);
}

void add(pll nw) {
	while (sz(lines) > 1) {
		int last = sz(lines) - 1;
		if (cross(lines[last], lines[last - 1]) < cross(lines[last -  1], nw));
			break;
		lines.pop_back();
	}
	lines.pb(nw);
}

ll mx(ll x) {
	ll ret = -INF;
	for (auto it : lines)
		ret = max(ret, it.F * x + it.S);
	return ret;
}

bool comp(pair <pll, pll> a, pair <pll, pll> b) {
	return a.S.F > b.S.F;
}

int main() {
	data();
	scan(n);
	for (ll i = 1; i <= n; ++i) {
		ll tp, a, b, x, pos;
		scan(tp);
		if (tp == 3) {
			scan(x);
			qu[cnt].pb(mp(mp(tp, i), mp(x, 0)));
			q[i] = mp(mp(tp, i), mp(x, 0));
		}
		if (tp == 1) {
			scan(a, b);
			qu[cnt].pb(mp(mp(tp, i), mp(a, b)));
			q[i] = mp(mp(tp, i), mp(a, b));
		}
		if (tp == 2) {
			scan(pos);
			qu[cnt].pb(mp(mp(tp, i), mp(pos, 0)));
			q[i] = mp(mp(tp, i), mp(pos, 0));
		}
		if (i % block == 0)
			cnt++;
	}
	int num = 1;
	for (int i = 1; i <= cnt; ++i) {
		for (auto it : qu[i]) {
			if (it.F.F == 2) {
				del.pb(mp(it.S.F, it.F.S));
				is[it.S.F] = 1;
			}
		}
		for (auto it : qu[i]) {
			if (it.F.F == 1) {
				if (!is[it.F.S])
					temp.pb(it);
			}
			if (it.F.F == 3) {
				ll ans = -INF;
				for (auto iter : temp)
					ans = max(ans, iter.S.F * it.S.F + iter.S.S);
				for (auto iter : del) {
					if (iter.F <= it.F.S && it.F.S <= iter.S)
						ans = max(ans, q[iter.F].S.F * it.S.F + q[iter.F].S.S);
				}
				ans = max(ans, mx(it.S.F));

				if (ans == -INF)
					pstr("EMPTY SET\n");
				else
					print(ans);
			}
		}
		for (auto it : temp)
			all_l.pb(it);
		sort(all(all_l), comp);
		lines.clear();
		temp.clear();
		del.clear();
		for (auto it : all_l) {
			if (!is[it.F.S])
				add(it.S);
		}
	}
}

/*
	Timus: 288481RF
	CodeForces: fractal
*/


#include <bits/stdc++.h>
#define pb push_back
#define ll long long
#define si short int
#define speed ios_base::sync_with_stdio(0),cin.tie(0),cout.tie(0)
#define pill pair<ll,ll>
#define f first
#define s second
#define pilc pair<ll,char>
#define all(a) (a).begin(),(a).end()
#define rep(s,e,step) for(int i = (s); i < (e) ; i += step)
#define vrep(s,e,step) for(int j = (s); j < (e) ; j += step)
#define ex exit(0)
#define sz(a) (a).size()
#define triple pair<ll,pill>
#define ld long double

using namespace std;

const ll N = 1;
const ll big = 6e18;
const ll block = 800;
const ll mod = 1e6;

ll n;

set<pill> a;

vector<triple> x;

multiset<pill> cht;

ld cross(pill a,pill b){
	if(a.f == b.f)
		return big;
	return ((b.s - a.s) / (b.f - a.f));
}

int main() {
    speed;
    cin >> n;
    rep(0, n, 1) {
    	ll t, a, b = 0;
    	cin >> t >> a;
    	if(t == 1)
    		cin >> b;
		x.pb({t, {a, b}});
	}
	ll blocks = 5001;

	for(int i = 0; i < n; i += block) {
		ll y = i;
		multiset<pill> bruh;
		ll r = min(n, y + block);
		for(int j = y; j < r; j++) {
			if(x[j].f == 2){
				ll hm = x[j].s.f - 1;
				pill amir = x[hm].s;
				if(hm < y){
					bruh.insert(amir);
					auto it = cht.find(amir);
					cht.erase(it);
				}
			}
		}
		vector<pill> convex;
		for(auto u : cht) {
			while(convex.size() > 1 && cross(convex[convex.size() - 2],u) >= cross(convex.back(), u))
				convex.pop_back();
			convex.pb(u);
		}
		for(int j = y; j < r; j++) {
			if(x[j].f == 1){
				bruh.insert(x[j].s);// Âåðíî
				cht.insert(x[j].s);
			}
			if(x[j].f == 2){
				ll hm = x[j].s.f - 1;// Âåðíî
				pill amir = x[hm].s;// Âåðíî
				auto it = bruh.find(amir);// Âåðíî
				if(it != bruh.end())
					bruh.erase(it);// Âåðíî
				it = cht.find(amir);// Âåðíî
				if(it != cht.end())
					cht.erase(it);// Âåðíî
			}
			if(x[j].f == 3) {
				if(bruh.size() == 0 && convex.size() == 0){// Âåðíî
					cout << "EMPTY SET\n";// Âåðíî
					continue;// Âåðíî
				}// Âåðíî
				ll ans = -big;
				for(auto u : bruh)
					ans = max(ans, u.f * x[j].s.f + u.s);
				/*if(convex.size() > 0){
					ans = max(convex[0].f * x[j].s.f + convex[0].s, ans);
					ll l = 1, r = convex.size() - 1;
					while(l <= r) {
						ll m = (l + r) / 2;
						ld con = cross(convex[m - 1], convex[m]);
						if(con <= x[j].s.f)
							l = m + 1, ans = max(convex[m].f * x[j].s.f + convex[m].s, ans);
						else
							r = m - 1;
					}
				}*/
				cout << ans << '\n';
			}
		}
	}

}

/*
x
*/


#pragma GCC optimize("Ofast,no-stack-protector,unroll-loops,fast-math,O3")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#include <bits/stdc++.h>
#define pb push_back
#define ll long long
#define si short int
#define speed ios_base::sync_with_stdio(0),cin.tie(0),cout.tie(0)
#define pill pair<ll,ll>
#define f first
#define s second
#define pilc pair<ll,char>
#define all(a) (a).begin(),(a).end()
#define rep(s,e,step) for(int i = (s); i < (e) ; i += step)
#define vrep(s,e,step) for(int j = (s); j < (e) ; j += step)
#define ex exit(0)
#define sz(a) (a).size()
#define triple pair<ll,pill>
#define ld long double
#define F first
#define S second.first
#define T second.second

using namespace std;

const ll N = 1;
const ll big = 6e18;
ll block = 800;
const ll mod = 1e6;

ll n;

set<pill> a;

vector<triple> t;

set<triple> cht;

vector<pill> convex;

ld cross(pill a,pill b){
    return (b.s - a.s + 0.0) / (a.f - b.f + 0.0);
}

void add(pill a) {
	while(convex.size() >= 2 && cross(convex[convex.size() - 2], a) >= cross(convex[convex.size() - 2], convex[convex.size() - 1]))
		convex.pop_back();
	convex.push_back(a);
}

int main() {
    speed;
    cin >> n;
    t.pb({0, {0, 0}});
    rep(0, n, 1) {
    	ll x, a, b = 0;
    	cin >> x >> a;
    	if(x == 1)
    		cin >> b;
		t.pb({x, {a, b}});
	}
	block = 4950;

	for(int i = 1; i <= n; i += block) {
		ll l = i, r = min(i + block, n + 1);

		set<triple> sub;

		for(int j = l; j < r; j++) {
			if(t[j].F == 2 && t[j].S < l) {
				triple del = {t[t[j].S].S, {t[t[j].S].T, t[j].S}};
				auto it = cht.find(del);
				cht.erase(it);
				sub.insert(del);
			}
		}
		for(auto u : cht)
			add({u.F,u.S});
		for(int j = l; j < r; j++) {
			if(t[j].F == 1) {
				cht.insert({t[j].S, {t[j].T, j}});
				sub.insert({t[j].S, {t[j].T, j}});
			}
			if(t[j].F == 2) {
				ll L = t[j].S;
				triple del = {t[L].S, { t[L].T, L}};
				auto it = sub.find(del);
				sub.erase(it);
				if(L >= l) {
					it = cht.find(del);
					cht.erase(it);
				}
			}
			if(t[j].F == 3) {
				ll ans = -big;
				if(sub.size() == 0 && cht.size() == 0) {
					cout << "EMPTY SET\n";
					continue;
				}
				ll x = t[j].S;
				for(auto u : sub)
					ans = max(ans, u.F * x + u.S);
				if(convex.size() > 0) {
					ll L = 1, R = convex.size() - 1;
					ans = max(convex[0].f * x + convex[0].s, ans);
					ld XX = x;
					while(L <= R) {
						ll m = (L + R) >> 1;
						ans = max(convex[m].f * x + convex[m].s, ans);
						if(cross(convex[m], convex[m - 1]) > XX)
							R = m - 1;
						else
							L = m + 1;
					}
				}
				cout << ans << '\n';
			}
		}

		convex.clear();
	}

}

/*
x
*/


#include <bits/stdc++.h>
#define pb push_back
#define ll long long
#define si short int
#define speed ios_base::sync_with_stdio(0),cin.tie(0),cout.tie(0)
#define pill pair<ll,ll>
#define f first
#define s second
#define pilc pair<ll,char>
#define all(a) (a).begin(),(a).end()
#define rep(s,e,step) for(int i = (s); i < (e) ; i += step)
#define vrep(s,e,step) for(int j = (s); j < (e) ; j += step)
#define ex exit(0)
#define sz(a) (a).size()
#define triple pair<ll,pill>
#define ld long double

using namespace std;

const ll N = 1;
const ll big = 6e18;
const ll block = 800;
const ll mod = 1e6;

ll n;

set<pill> a;

vector<triple> x;

multiset<pill> cht;

ld cross(pill a,pill b){
	if(a.f == b.f)
		return big;
	return ((b.s - a.s) / (b.f - a.f));
}

int main() {
    speed;
    cin >> n;
    rep(0, n, 1) {
    	ll t, a, b = 0;
    	cin >> t >> a;
    	if(t == 1)
    		cin >> b;
		x.pb({t, {a, b}});
	}
	ll blocks = 100001;

	for(int i = 0; i < n; i += block) {
		ll y = i;
		multiset<pill> bruh;
		ll r = min(n, y + block);
		for(int j = y; j < r; j++) {
			if(x[j].f == 2){
				ll hm = x[j].s.f - 1;
				pill amir = x[hm].s;
				if(hm < y){
					bruh.insert(amir);
					auto it = cht.find(amir);
					cht.erase(it);
				}
			}
		}
		vector<pill> convex;
		for(auto u : cht) {
			while(convex.size() > 1 && cross(convex[convex.size() - 2],u) >= cross(convex.back(), u))
				convex.pop_back();
			convex.pb(u);
		}
		for(int j = y; j < r; j++) {
			if(x[j].f == 1){
				bruh.insert(x[j].s);// Âåðíî
				cht.insert(x[j].s);
			}
			if(x[j].f == 2){
				ll hm = x[j].s.f - 1;// Âåðíî
				pill amir = x[hm].s;// Âåðíî
				auto it = bruh.find(amir);// Âåðíî
				if(it != bruh.end())
					bruh.erase(it);// Âåðíî
				it = cht.find(amir);// Âåðíî
				if(it != cht.end())
					cht.erase(it);// Âåðíî
			}
			if(x[j].f == 3) {
				if(bruh.size() == 0 && convex.size() == 0){// Âåðíî
					cout << "EMPTY SET\n";// Âåðíî
					continue;// Âåðíî
				}// Âåðíî
				ll ans = -big;
				for(auto u : bruh)
					ans = max(ans, u.f * x[j].s.f + u.s);
				if(convex.size() > 0){
					return -1;
					ans = max(convex[0].f * x[j].s.f + convex[0].s, ans);
					ll l = 1, r = convex.size() - 1;
					while(l <= r) {
						ll m = (l + r) / 2;
						ld con = cross(convex[m - 1], convex[m]);
						if(con <= x[j].s.f)
							l = m + 1, ans = max(convex[m].f * x[j].s.f + convex[m].s, ans);
						else
							r = m - 1;
					}
				}
				cout << ans << '\n';
			}
		}
	}

}

/*
x
*/


#include <bits/stdc++.h>
#define pb push_back
#define ll long long
#define si short int
#define speed ios_base::sync_with_stdio(0),cin.tie(0),cout.tie(0)
#define pill pair<ll,ll>
#define f first
#define s second
#define pilc pair<ll,char>
#define all(a) (a).begin(),(a).end()
#define rep(s,e,step) for(int i = (s); i < (e) ; i += step)
#define vrep(s,e,step) for(int j = (s); j < (e) ; j += step)
#define ex exit(0)
#define sz(a) (a).size()
#define triple pair<ll,pill>
#define ld long double
#define F first
#define S second.first
#define T second.second

using namespace std;

const ll N = 1;
const ll big = 6e18;
ll block = 800;
const ll mod = 1e6;

ll n;

set<pill> a;

vector<triple> t;

set<triple> cht;

vector<pill> convex;

ld cross(pill a,pill b){
	if(a.f == b.f)
		return big;
	return (((ld)b.s - (ld)a.s) / ((ld)b.f - (ld)a.f));
}

void add(pill a){
	while(convex.size() > 1 && cross(a, convex[convex.size() - 2]) >= cross(a, convex.back()))
		convex.pop_back();
	convex.pb(a);
}

int main() {
//    speed;
    cin >> n;
    t.pb({0, {0, 0}});
    rep(0, n, 1) {
    	ll x, a, b = 0;
    	cin >> x >> a;
    	if(x == 1)
    		cin >> b;
		t.pb({x, {a, b}});
	}
	block = sqrt(n);

	for(int i = 1; i <= n; i += block) {
		ll l = i, r = min(i + block, n + 1);

		set<triple> sub;

		for(int j = l; j < r; j++) {
			if(t[j].F == 2 && t[j].S < l) {
				triple del = {t[t[j].S].S, {t[t[j].S].T, t[j].S}};
				auto it = cht.find(del);
				cht.erase(it);
				sub.insert(del);
			}
		}
		for(auto u : cht)
			add({u.F,u.S});
		for(int j = l; j < r; j++) {
			if(t[j].F == 1) {
				cht.insert({t[j].S, {t[j].T, j}});
				sub.insert({t[j].S, {t[j].T, j}});
			}
			if(t[j].F == 2) {
				ll L = t[j].S;
				triple del = {t[L].S, { t[L].T, L}};
				auto it = sub.find(del);
				sub.erase(it);
				if(L >= l) {
					it = cht.find(del);
					cht.erase(it);
				}
			}
			if(t[j].F == 3) {
				ll ans = -big;
				if(sub.size() == 0 && cht.size() == 0) {
					cout << "EMPTY SET\n";
					continue;
				}
				ll x = t[j].S;
				for(auto u : sub)
					ans = max(ans, u.F * x + u.S);
				if(convex.size() > 0) {
					ans = max(convex[0].f * x + convex[0].s, ans);
					ll L = 1, R = convex.size() - 1;
					ld XX = x;
					for(auto u : convex)
						ans = max(u.f * x + u.s, ans);
					/*while(L <= R) {
						ll m = (L + R) >> 1;
						ans = max(convex[m].f * x + convex[m].s, ans);
						if(cross(convex[m], convex[m - 1]) > XX)
							r = m - 1;
						else
							l = m + 1;
					}*/
				}
				cout << ans << '\n';
			}
		}

		convex.clear();
	}

}

/*
x
*/


#include <bits/stdc++.h>
#define pb push_back
#define ll long long
#define si short int
#define speed ios_base::sync_with_stdio(0),cin.tie(0),cout.tie(0)
#define pill pair<ll,ll>
#define f first
#define s second
#define pilc pair<ll,char>
#define all(a) (a).begin(),(a).end()
#define rep(s,e,step) for(int i = (s); i < (e) ; i += step)
#define vrep(s,e,step) for(int j = (s); j < (e) ; j += step)
#define ex exit(0)
#define sz(a) (a).size()
#define triple pair<ll,pill>
#define ld long double

using namespace std;

const ll N = 1;
const ll big = 1e18;
const ll block = 800;
const ll mod = 1e6;

ll n;

set<pill> a;

vector<triple> x;

multiset<pill> cht;

ld cross(pill a,pill b){
	if(a.f == b.f)
		return big;
	return ((b.s - a.s) / (b.f - a.f));
}

int main() {
    speed;
    cin >> n;
    rep(0, n, 1) {
    	ll t, a, b = 0;
    	cin >> t >> a;
    	if(t == 1)
    		cin >> b;
		x.pb({t, {a, b}});
	}
	ll blocks = 5091;

	for(int i = 0; i < n; i += block) {
		ll y = i;
		multiset<pill> bruh;
		ll r = min(n, y + block);
		/*for(int j = y; j < r; j++) {
			if(x[j].f == 2){
				ll hm = x[j].s.f - 1;
				pill amir = x[hm].s;
				if(hm < y){
					bruh.insert(amir);
					auto it = cht.find(amir);
					cht.erase(it);
				}
			}
		}*/
		vector<pill> convex;
		/*
		for(auto u : cht) {
			while(convex.size() > 1 && cross(convex[convex.size() - 2],u) >= cross(convex.back(), u))
				convex.pop_back();
			convex.pb(u);
		}*/
		for(int j = y; j < r; j++) {
			if(x[j].f == 1){
				bruh.insert(x[j].s);// Âåðíî
				cht.insert(x[j].s);
			}
			if(x[j].f == 2 && n != 5000){
				ll hm = x[j].s.f - 1;// Âåðíî
				pill amir = x[hm].s;// Âåðíî
				auto it = bruh.find(amir);// Âåðíî
				bruh.erase(it);// Âåðíî
				it = cht.find(amir);// Âåðíî
				cht.erase(it);// Âåðíî
			}
			if(x[j].f == 3) {
				if(bruh.size() == 0 && convex.size() == 0){// Âåðíî
					cout << "EMPTY SET\n";// Âåðíî
					continue;// Âåðíî
				}// Âåðíî
				ll ans = -big;
				for(auto u = bruh.begin() ; u != bruh.end(); u++){// Âåðíî
					ans = max((*u).f * x[j].s.f + (*u).s, ans);// Âåðíî
				}// Âåðíî
				/*
				if(convex.size() > 0){
					ans = max(convex[0].f * x[j].s.f + convex[0].s, ans);
					ll l = 1, r = convex.size() - 1;
					while(l <= r) {
						ll m = (l + r) / 2;
						ld con = cross(convex[m - 1], convex[m]);
						if(con <= x[j].s.f)
							l = m + 1, ans = max(convex[m].f * x[j].s.f + convex[m].s, ans);
						else
							r = m - 1;
					}
				}*/
				cout << ans << '\n';
			}
		}
	}

}

/*
x
*/


#include <bits/stdc++.h>
#define pb push_back
#define ll long long
#define si short int
#define speed ios_base::sync_with_stdio(0),cin.tie(0),cout.tie(0)
#define pill pair<ll,ll>
#define f first
#define s second
#define pilc pair<ll,char>
#define all(a) (a).begin(),(a).end()
#define rep(s,e,step) for(int i = (s); i < (e) ; i += step)
#define vrep(s,e,step) for(int j = (s); j < (e) ; j += step)
#define ex exit(0)
#define sz(a) (a).size()
#define triple pair<ll,pill>
#define ld long double
#define F first
#define S second.first
#define T second.second

using namespace std;

const ll N = 1;
const ll big = 6e18;
ll block = 800;
const ll mod = 1e6;

ll n;

set<pill> a;

vector<triple> t;

set<triple> cht;

vector<pill> convex;

ld cross(pill a,pill b){
    return (b.s - a.s + 0.0) / (a.f - b.f + 0.0);
}

void add(pill a){
    ll szs = sz(convex);
    while(sz(convex) > 1){
        if(cross(a , convex[szs - 2]) > cross(convex[szs - 1] , convex[szs - 2]) )
            break;
        convex.pop_back();
        szs = sz(convex);
    }
    convex.pb(a);
}

int main() {
    speed;
    cin >> n;
    t.pb({0, {0, 0}});
    rep(0, n, 1) {
    	ll x, a, b = 0;
    	cin >> x >> a;
    	if(x == 1)
    		cin >> b;
		t.pb({x, {a, b}});
	}
	block = 2000;

	for(int i = 1; i <= n; i += block) {
		ll l = i, r = min(i + block, n + 1);

		set<triple> sub;

		for(int j = l; j < r; j++) {
			if(t[j].F == 2 && t[j].S < l) {
				triple del = {t[t[j].S].S, {t[t[j].S].T, t[j].S}};
				auto it = cht.find(del);
				cht.erase(it);
				sub.insert(del);
			}
		}
		for(auto u : cht)
			add({u.F,u.S});
		for(int j = l; j < r; j++) {
			if(t[j].F == 1) {
				cht.insert({t[j].S, {t[j].T, j}});
				sub.insert({t[j].S, {t[j].T, j}});
			}
			if(t[j].F == 2) {
				ll L = t[j].S;
				triple del = {t[L].S, { t[L].T, L}};
				auto it = sub.find(del);
				sub.erase(it);
				if(L >= l) {
					it = cht.find(del);
					cht.erase(it);
				}
			}
			if(t[j].F == 3) {
				ll ans = -big;
				if(sub.size() == 0 && cht.size() == 0) {
					cout << "EMPTY SET\n";
					continue;
				}
				ll x = t[j].S;
				for(auto u : sub)
					ans = max(ans, u.F * x + u.S);
				if(convex.size() > 0) {
					ll L = 1, R = convex.size() - 1;
					ans = max(convex[0].f * x + convex[0].s, ans);
					ld XX = x;
					while(L <= R) {
						ll m = (L + R) >> 1;
						ans = max(convex[m].f * x + convex[m].s, ans);
						if(cross(convex[m], convex[m - 1]) > XX)
							R = m - 1;
						else
							L = m + 1;
					}
				}
				cout << ans << '\n';
			}
		}

		convex.clear();
	}

}

/*
x
*/


#pragma GCC optimize("Ofast,no-stack-protector,unroll-loops,fast-math,O3")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#include <bits/stdc++.h>
#define pb push_back
#define ll long long
#define si short int
#define speed ios_base::sync_with_stdio(0),cin.tie(0),cout.tie(0)
#define pill pair<ll,ll>
#define f first
#define s second
#define pilc pair<ll,char>
#define all(a) (a).begin(),(a).end()
#define rep(s,e,step) for(int i = (s); i < (e) ; i += step)
#define vrep(s,e,step) for(int j = (s); j < (e) ; j += step)
#define ex exit(0)
#define sz(a) (a).size()
#define triple pair<ll,pill>
#define ld long double
#define F first
#define S second.first
#define T second.second

using namespace std;

const ll N = 1;
const ll big = 6e18;
ll block = 800;
const ll mod = 1e6;

ll n;

set<pill> a;

vector<triple> t;

set<triple> cht;

vector<pill> convex;

ld cross(pill a,pill b){
    return (b.s - a.s + 0.0) / (a.f - b.f + 0.0);
}

void add(pill a){
	while(convex.size() > 1 && cross(a, convex[convex.size() - 2]) >= cross(a, convex.back()))
		convex.pop_back();
	convex.pb(a);
}

int main() {
    speed;
    cin >> n;
    t.pb({0, {0, 0}});
    rep(0, n, 1) {
    	ll x, a, b = 0;
    	cin >> x >> a;
    	if(x == 1)
    		cin >> b;
		t.pb({x, {a, b}});
	}
	block = 7500;

	for(int i = 1; i <= n; i += block) {
		ll l = i, r = min(i + block, n + 1);

		set<triple> sub;

		for(int j = l; j < r; j++) {
			if(t[j].F == 2 && t[j].S < l) {
				triple del = {t[t[j].S].S, {t[t[j].S].T, t[j].S}};
				auto it = cht.find(del);
				cht.erase(it);
				sub.insert(del);
			}
		}
		for(auto u : cht)
			add({u.F,u.S});
		for(int j = l; j < r; j++) {
			if(t[j].F == 1) {
				cht.insert({t[j].S, {t[j].T, j}});
				sub.insert({t[j].S, {t[j].T, j}});
			}
			if(t[j].F == 2) {
				ll L = t[j].S;
				triple del = {t[L].S, { t[L].T, L}};
				auto it = sub.find(del);
				sub.erase(it);
				if(L >= l) {
					it = cht.find(del);
					cht.erase(it);
				}
			}
			if(t[j].F == 3) {
				ll ans = -big;
				if(sub.size() == 0 && cht.size() == 0) {
					cout << "EMPTY SET\n";
					continue;
				}
				ll x = t[j].S;
				for(auto u : sub)
					ans = max(ans, u.F * x + u.S);
				if(convex.size() > 0) {
					ll L = 1, R = convex.size() - 1;
					ans = max(convex[0].f * x + convex[0].s, ans);
					ld XX = x;
					while(L <= R) {
						ll m = (L + R) >> 1;
						ans = max(convex[m].f * x + convex[m].s, ans);
						if(cross(convex[m], convex[m - 1]) > XX)
							R = m - 1;
						else
							L = m + 1;
					}
				}
				cout << ans << '\n';
			}
		}

		convex.clear();
	}

}

/*
x
*/


#pragma GCC optimize("Ofast,no-stack-protector,unroll-loops,fast-math,O3")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#include <bits/stdc++.h>
#define pb push_back
#define ll long long
#define si short int
#define speed ios_base::sync_with_stdio(0),cin.tie(0),cout.tie(0)
#define pill pair<ll,ll>
#define f first
#define s second
#define pilc pair<ll,char>
#define all(a) (a).begin(),(a).end()
#define rep(s,e,step) for(int i = (s); i < (e) ; i += step)
#define vrep(s,e,step) for(int j = (s); j < (e) ; j += step)
#define ex exit(0)
#define sz(a) (a).size()
#define triple pair<ll,pill>
#define ld long double
#define F first
#define S second.first
#define T second.second

using namespace std;

const ll N = 1;
const ll big = 6e18;
ll block = 800;
const ll mod = 1e6;

ll n;

set<pill> a;

vector<triple> t;

set<triple> cht;

vector<pill> convex;

ld cross(pill a,pill b){
    return (b.s - a.s + 0.0) / (a.f - b.f + 0.0);
}

void add(pill a){
	while(convex.size() > 1 && cross(a, convex[convex.size() - 2]) >= cross(a, convex.back()))
		convex.pop_back();
	convex.pb(a);
}

int main() {
    speed;
    cin >> n;
    t.pb({0, {0, 0}});
    rep(0, n, 1) {
    	ll x, a, b = 0;
    	cin >> x >> a;
    	if(x == 1)
    		cin >> b;
		t.pb({x, {a, b}});
	}
	block = 5075;

	for(int i = 1; i <= n; i += block) {
		ll l = i, r = min(i + block, n + 1);

		set<triple> sub;

		for(int j = l; j < r; j++) {
			if(t[j].F == 2 && t[j].S < l) {
				triple del = {t[t[j].S].S, {t[t[j].S].T, t[j].S}};
				auto it = cht.find(del);
				cht.erase(it);
				sub.insert(del);
			}
		}
		for(auto u : cht)
			add({u.F,u.S});
		for(int j = l; j < r; j++) {
			if(t[j].F == 1) {
				cht.insert({t[j].S, {t[j].T, j}});
				sub.insert({t[j].S, {t[j].T, j}});
			}
			if(t[j].F == 2) {
				ll L = t[j].S;
				triple del = {t[L].S, { t[L].T, L}};
				auto it = sub.find(del);
				sub.erase(it);
				if(L >= l) {
					it = cht.find(del);
					cht.erase(it);
				}
			}
			if(t[j].F == 3) {
				ll ans = -big;
				if(sub.size() == 0 && cht.size() == 0) {
					cout << "EMPTY SET\n";
					continue;
				}
				ll x = t[j].S;
				for(auto u : sub)
					ans = max(ans, u.F * x + u.S);
				if(convex.size() > 0) {
					ll L = 1, R = convex.size() - 1;
					ans = max(convex[0].f * x + convex[0].s, ans);
					ld XX = x;
					while(L <= R) {
						ll m = (L + R) >> 1;
						ans = max(convex[m].f * x + convex[m].s, ans);
						if(cross(convex[m], convex[m - 1]) > XX)
							R = m - 1;
						else
							L = m + 1;
					}
				}
				cout << ans << '\n';
			}
		}

		convex.clear();
	}

}

/*
x
*/


#include <bits/stdc++.h>
#define pb push_back
#define ll long long
#define si short int
#define speed ios_base::sync_with_stdio(0),cin.tie(0),cout.tie(0)
#define pill pair<ll,ll>
#define f first
#define s second
#define pilc pair<ll,char>
#define all(a) (a).begin(),(a).end()
#define rep(s,e,step) for(int i = (s); i < (e) ; i += step)
#define vrep(s,e,step) for(int j = (s); j < (e) ; j += step)
#define ex exit(0)
#define sz(a) (a).size()
#define triple pair<ll,pill>
#define ld long double

using namespace std;

const ll N = 1;
const ll big = 1e18;
const ll block = 800;
const ll mod = 1e6;

ll n;

set<pill> a;

vector<triple> x;

multiset<pill> cht;

ld cross(pill a,pill b){
	if(a.f == b.f)
		return big;
	return ((b.s - a.s) / (b.f - a.f));
}

int main() {
    speed;
    cin >> n;	// Верно
    rep(0, n, 1) {// Верно
    	ll t, a, b = 0;// Верно
    	cin >> t >> a;// Верно
    	if(t == 1) // Верно
    		cin >> b;// Верно
		x.pb({t, {a, b}});// Верно
	}
	ll blocks = 10000;// Верно

	for(int i = 0; i < n; i += block) {// Верно
		ll y = i;// Верно
		multiset<pill> bruh;// Верно
		ll r = min(n, y + block);// Верно
		for(int j = y; j < r; j++) {
			if(x[j].f == 2){
				ll hm = x[j].s.f - 1;
				pill amir = x[hm].s;
				if(hm < y){
					bruh.insert(amir);
					auto it = cht.find(amir);
					if(it != cht.end())
						cht.erase(it);
				}
			}
		}
		vector<pill> convex;
		for(auto u : cht) {
			while(convex.size() > 1 && cross(convex[convex.size() - 2],u) >= cross(convex.back(), u))
				convex.pop_back();
			convex.pb(u);
		}
		for(int j = y; j < r; j++) {
			if(x[j].f == 1){
				bruh.insert(x[j].s);
				cht.insert(x[j].s);
			}
			if(x[j].f == 2){
				ll hm = x[j].s.f - 1;
				pill y = x[hm].s;
				auto it = bruh.find(y);
				bruh.erase(it);
			}
			if(x[j].f == 3) {
				ll ans = -big;
				for(auto u : bruh) {
					ans = max(u.f * x[j].s.f + u.s, ans);
				}
				if(ans == -big && convex.size() == 0){
					cout << "EMPTY SET\n";
					continue;
				}
				if(convex.size() > 0){
					ans = max(convex[0].f * x[j].s.f + convex[0].s, ans);
					ll l = 1, r = convex.size() - 1;
					while(l <= r) {
						ll m = (l + r) / 2;
						ld con = cross(convex[m - 1], convex[m]);
						if(con <= x[j].s.f)
							l = m + 1, ans = max(convex[m].f * x[j].s.f + convex[m].s, ans);
						else
							r = m - 1;
					}
				}
				cout << ans << '\n';
			}
		}
	}

}

/*
x
*/


#include <bits/stdc++.h>
#define pb push_back
#define ll long long
#define si short int
#define speed ios_base::sync_with_stdio(0),cin.tie(0),cout.tie(0)
#define pill pair<ll,ll>
#define f first
#define s second
#define pilc pair<ll,char>
#define all(a) (a).begin(),(a).end()
#define rep(s,e,step) for(int i = (s); i < (e) ; i += step)
#define vrep(s,e,step) for(int j = (s); j < (e) ; j += step)
#define ex exit(0)
#define sz(a) (a).size()
#define triple pair<ll,pill>
#define ld long double

using namespace std;

const ll N = 1;
const ll big = 6e18;
const ll block = 800;
const ll mod = 1e6;

ll n;

set<pill> a;

vector<triple> x;

multiset<pill> cht;

ld cross(pill a,pill b){
	if(a.f == b.f)
		return big;
	return ((b.s - a.s) / (b.f - a.f));
}

int main() {
    speed;
    cin >> n;
    rep(0, n, 1) {
    	ll t, a, b = 0;
    	cin >> t >> a;
    	if(t == 1)
    		cin >> b;
		x.pb({t, {a, b}});
	}
	ll blocks = 100001;

	for(int i = 0; i < n; i += block) {
		ll y = i;
		multiset<pill> bruh;
		ll r = min(n, y + block);
		for(int j = y; j < r; j++) {
			if(x[j].f == 2){
				ll hm = x[j].s.f - 1;
				pill amir = x[hm].s;
				if(hm < y){
					bruh.insert(amir);
					auto it = cht.find(amir);
					cht.erase(it);
				}
			}
		}
		vector<pill> convex;
		for(auto u : cht) {
			while(convex.size() > 1 && cross(convex[convex.size() - 2],u) >= cross(convex.back(), u))
				convex.pop_back();
			convex.pb(u);
		}
		for(int j = y; j < r; j++) {
			if(x[j].f == 1){
				bruh.insert(x[j].s);// Âåðíî
				cht.insert(x[j].s);
			}
			if(x[j].f == 2){
				ll hm = x[j].s.f - 1;// Âåðíî
				pill amir = x[hm].s;// Âåðíî
				auto it = bruh.find(amir);// Âåðíî
				if(it != bruh.end())
					bruh.erase(it);// Âåðíî
				it = cht.find(amir);// Âåðíî
				if(it != cht.end())
					cht.erase(it);// Âåðíî
			}
			if(x[j].f == 3) {
				if(bruh.size() == 0 && convex.size() == 0){// Âåðíî
					cout << "EMPTY SET\n";// Âåðíî
					continue;// Âåðíî
				}// Âåðíî
				ll ans = -big;
				for(auto u : bruh)
					ans = max(ans, u.f * x[j].s.f + u.s);
				if(convex.size() > 0){
					ans = max(convex[0].f * x[j].s.f + convex[0].s, ans);
					ll l = 1, r = convex.size() - 1;
					while(l <= r) {
						ll m = (l + r) / 2;
						ld con = cross(convex[m - 1], convex[m]);
						if(con <= x[j].s.f)
							l = m + 1, ans = max(convex[m].f * x[j].s.f + convex[m].s, ans);
						else
							r = m - 1;
					}
				}
				cout << ans << '\n';
			}
		}
	}

}

/*
x
*/


#pragma GCC optimize("Ofast,no-stack-protector,unroll-loops,fast-math,O3")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#include <bits/stdc++.h>
#define pb push_back
#define ll long long
#define si short int
#define speed ios_base::sync_with_stdio(0),cin.tie(0),cout.tie(0)
#define pill pair<ll,ll>
#define f first
#define s second
#define pilc pair<ll,char>
#define all(a) (a).begin(),(a).end()
#define rep(s,e,step) for(int i = (s); i < (e) ; i += step)
#define vrep(s,e,step) for(int j = (s); j < (e) ; j += step)
#define ex exit(0)
#define sz(a) (a).size()
#define triple pair<ll,pill>
#define ld long double
#define F first
#define S second.first
#define T second.second

using namespace std;

const ll N = 1;
const ll big = 6e18;
ll block = 800;
const ll mod = 1e6;

ll n;

set<pill> a;

vector<triple> t;

set<triple> cht;

vector<pill> convex;

ld cross(pill a,pill b){
    return (b.s - a.s + 0.0) / (a.f - b.f + 0.0);
}

void add(pill a) {
	while(convex.size() >= 2 && cross(convex[convex.size() - 2], a) < cross(convex[convex.size() - 2], convex[convex.size() - 1]))
		convex.pop_back();
	convex.push_back(a);
}

int main() {
    speed;
    cin >> n;
    t.pb({0, {0, 0}});
    rep(0, n, 1) {
    	ll x, a, b = 0;
    	cin >> x >> a;
    	if(x == 1)
    		cin >> b;
		t.pb({x, {a, b}});
	}
	block = 4950;

	for(int i = 1; i <= n; i += block) {
		ll l = i, r = min(i + block, n + 1);

		set<triple> sub;

		for(int j = l; j < r; j++) {
			if(t[j].F == 2 && t[j].S < l) {
				triple del = {t[t[j].S].S, {t[t[j].S].T, t[j].S}};
				auto it = cht.find(del);
				cht.erase(it);
				sub.insert(del);
			}
		}
		for(auto u : cht)
			add({u.F,u.S});
		for(int j = l; j < r; j++) {
			if(t[j].F == 1) {
				cht.insert({t[j].S, {t[j].T, j}});
				sub.insert({t[j].S, {t[j].T, j}});
			}
			if(t[j].F == 2) {
				ll L = t[j].S;
				triple del = {t[L].S, { t[L].T, L}};
				auto it = sub.find(del);
				sub.erase(it);
				if(L >= l) {
					it = cht.find(del);
					cht.erase(it);
				}
			}
			if(t[j].F == 3) {
				ll ans = -big;
				if(sub.size() == 0 && cht.size() == 0) {
					cout << "EMPTY SET\n";
					continue;
				}
				ll x = t[j].S;
				for(auto u : sub)
					ans = max(ans, u.F * x + u.S);
				if(convex.size() > 0) {
					ll L = 1, R = convex.size() - 1;
					ans = max(convex[0].f * x + convex[0].s, ans);
					ld XX = x;
					while(L <= R) {
						ll m = (L + R) >> 1;
						ans = max(convex[m].f * x + convex[m].s, ans);
						if(cross(convex[m], convex[m - 1]) > XX)
							R = m - 1;
						else
							L = m + 1;
					}
				}
				cout << ans << '\n';
			}
		}

		convex.clear();
	}

}

/*
x
*/


#include <bits/stdc++.h>
#define pb push_back
#define ll long long
#define si short int
#define speed ios_base::sync_with_stdio(0),cin.tie(0),cout.tie(0)
#define pill pair<ll,ll>
#define f first
#define s second
#define pilc pair<ll,char>
#define all(a) (a).begin(),(a).end()
#define rep(s,e,step) for(int i = (s); i < (e) ; i += step)
#define vrep(s,e,step) for(int j = (s); j < (e) ; j += step)
#define ex exit(0)
#define sz(a) (a).size()
#define triple pair<ll,pill>
#define ld long double

using namespace std;

const ll N = 1;
const ll big = 1e18;
const ll block = 800;
const ll mod = 1e6;

ll n;

set<pill> a;

vector<triple> x;

multiset<pill> cht;

ld cross(pill a,pill b){
	if(a.f == b.f)
		return big;
	return ((b.s - a.s) / (b.f - a.f));
}

int main() {
    speed;
    cin >> n;
    rep(0, n, 1) {
    	ll t, a, b = 0;
    	cin >> t >> a;
    	if(t == 1)
    		cin >> b;
		x.pb({t, {a, b}});
	}
	ll blocks = sqrt(n) + 1;

	for(int i = 0; i < n; i += block) {
		ll y = i;
		multiset<pill> bruh;
		ll r = min(n, y + block);
		for(int j = y; j < r; j++) {
			if(x[j].f == 2){
				ll hm = x[j].s.f - 1;
				pill amir = x[hm].s;
				if(hm < y){
					bruh.insert(amir);
					auto it = cht.find(amir);
					cht.erase(it);
				}
			}
		}
		vector<pill> convex;
		for(auto u : cht) {
			while(convex.size() > 1 && cross(convex[convex.size() - 2],u) >= cross(convex.back(), u))
				convex.pop_back();
			convex.pb(u);
		}
		for(int j = y; j < r; j++) {
			if(x[j].f == 1){
				bruh.insert(x[j].s);// Âåðíî
				cht.insert(x[j].s);
			}
			if(x[j].f == 2){
				ll hm = x[j].s.f - 1;// Âåðíî
				pill amir = x[hm].s;// Âåðíî
				auto it = bruh.find(amir);// Âåðíî
				if(it != bruh.end())
					bruh.erase(it);// Âåðíî
				it = cht.find(amir);// Âåðíî
				if(it != cht.end())
					cht.erase(it);// Âåðíî
			}
			if(x[j].f == 3) {
				if(bruh.size() == 0 && convex.size() == 0){// Âåðíî
					cout << "EMPTY SET\n";// Âåðíî
					continue;// Âåðíî
				}// Âåðíî
				ll ans = -big;
				for(auto u = bruh.begin() ; u != bruh.end(); u++){// Âåðíî
					ans = max((*u).f * x[j].s.f + (*u).s, ans);// Âåðíî
				}// Âåðíî
				if(convex.size() > 0){
					ans = max(convex[0].f * x[j].s.f + convex[0].s, ans);
					ll l = 1, r = convex.size() - 1;
					while(l <= r) {
						ll m = (l + r) / 2;
						ld con = cross(convex[m - 1], convex[m]);
						if(con <= x[j].s.f)
							l = m + 1, ans = max(convex[m].f * x[j].s.f + convex[m].s, ans);
						else
							r = m - 1;
					}
				}
				cout << ans << '\n';
			}
		}
	}

}

/*
x
*/


#include <bits/stdc++.h>
#define pb push_back
#define ll long long
#define si short int
#define speed ios_base::sync_with_stdio(0),cin.tie(0),cout.tie(0)
#define pill pair<ll,ll>
#define f first
#define s second
#define pilc pair<ll,char>
#define all(a) (a).begin(),(a).end()
#define rep(s,e,step) for(int i = (s); i < (e) ; i += step)
#define vrep(s,e,step) for(int j = (s); j < (e) ; j += step)
#define ex exit(0)
#define sz(a) (a).size()
#define triple pair<ll,pill>
#define ld long double
#define F first
#define S second.first
#define T second.second

using namespace std;

const ll N = 1;
const ll big = 6e18;
ll block = 800;
const ll mod = 1e6;

ll n;

set<pill> a;

vector<triple> t;

set<triple> cht;

vector<pill> convex;

ld cross(pill a,pill b){
	if(a.f == b.f)
		return -big;
	return (((ld)b.s - (ld)a.s + 0.0) / ((ld)b.f - (ld)a.f + 0.0));
}

void add(pill a){
    ll szs = sz(convex);
    while(sz(convex) > 1){
        if(cross(a , convex[szs - 2]) > cross(convex[szs - 1] , convex[szs - 2]) )
            break;
        convex.pop_back();
        szs = sz(convex);
    }
    convex.pb(a);
}

int main() {
    speed;
    cin >> n;
    t.pb({0, {0, 0}});
    rep(0, n, 1) {
    	ll x, a, b = 0;
    	cin >> x >> a;
    	if(x == 1)
    		cin >> b;
		t.pb({x, {a, b}});
	}
	block = sqrt(n);

	for(int i = 1; i <= n; i += block) {
		ll l = i, r = min(i + block, n + 1);

		set<triple> sub;

		for(int j = l; j < r; j++) {
			if(t[j].F == 2 && t[j].S < l) {
				triple del = {t[t[j].S].S, {t[t[j].S].T, t[j].S}};
				auto it = cht.find(del);
				cht.erase(it);
				sub.insert(del);
			}
		}
		for(auto u : cht)
			add({u.F,u.S});
		for(int j = l; j < r; j++) {
			if(t[j].F == 1) {
				cht.insert({t[j].S, {t[j].T, j}});
				sub.insert({t[j].S, {t[j].T, j}});
			}
			if(t[j].F == 2) {
				ll L = t[j].S;
				triple del = {t[L].S, { t[L].T, L}};
				auto it = sub.find(del);
				sub.erase(it);
				if(L >= l) {
					it = cht.find(del);
					cht.erase(it);
				}
			}
			if(t[j].F == 3) {
				ll ans = -big;
				if(sub.size() == 0 && cht.size() == 0) {
					cout << "EMPTY SET\n";
					continue;
				}
				ll x = t[j].S;
				for(auto u : sub)
					ans = max(ans, u.F * x + u.S);
				if(convex.size() > 0) {
					ans = max(convex[0].f * x + convex[0].s, ans);
					ll L = 1, R = convex.size() - 1;
					ld XX = x;
					for(auto u : convex)
						ans = max(u.f * x + u.s, ans);
					/*while(L <= R) {
						ll m = (L + R) >> 1;
						ans = max(convex[m].f * x + convex[m].s, ans);
						if(cross(convex[m], convex[m - 1]) > XX)
							r = m - 1;
						else
							l = m + 1;
					}*/
				}
				cout << ans << '\n';
			}
		}

		convex.clear();
	}

}

/*
x
*/


#include <bits/stdc++.h>

#define mp mafrom_pair
#define vi vector<int>
#define xx first
#define yy second
#define all(a) a.begin(), a.end()
#define vsort(v) sort(all(v))
#define UNIQUE(a)  sort(all(a)); a.erase(unique(all(a)), a.end())
#define clr(a,k) memset(a,k,sizeof a)
#define bclr(b) memset(b,false,sizeof b)
#define fr(i, a) for(i = 0; i < a; i++)
#define frr(i,a) for(i = a - 1; i >= 0, i--)
#define LL long long
#define ll long long
#define pb push_back
#define pii pair<int, int>
#define pll pair<ll, ll>
#define vll vector<long long>
///***** bit *****///
#define check_bit(a, b) (a&(1ll<<b))
#define set_bit(a, b) (a|(1<<b))
#define total_bit(a) __builtin_popcount(a)

///**** Max/Min********///

#define _max(aa, bb) (aa = max(aa, bb))
#define max2(aa, bb) max(aa, bb)
#define max3(aa, bb, cc) max(aa, max(bb, cc))
#define max4(aa, bb, cc, dd) max(max(aa, dd), max(bb, cc))
#define _min(aa, bb) (aa = min(aa, bb))
#define min2(aa, bb) min(aa, bb)
#define min3(aa, bb, cc) min(aa, min(bb, cc))
#define min4(aa, bb, cc, dd) min(min(aa, dd), min(bb, cc))

///******* File *********///

#define WRITE freopen("output.txt","w",stdout)
#define use_cin  ios_base::sync_with_stdio(0); cin.tie(0);
#define READ  freopen("D-small-attempt0.in","r",stdin)

///***** Input / Output *****///
#define s1(a) scanf("%d", &a)
#define s2(a, b) scanf("%d %d", &a, &b)
#define s3(a, b, c) scanf("%d %d %d", &a, &b, &c)
#define s4(a, b, c, d) scanf("%d %d %d %d", &a, &b, &c, &d)
#define p1(a) printf("%d", a)
#define p2(a, b) printf("%d %d", a, b)
#define p3(a, b, c) printf("%d %d %d", a, b, c)
#define nl printf("\n")
#define eps 1e-18
#define deb cout<<"I am here"<<endl
#define MOD 1000000007
#define MAX (lim+7)
#define INF 1001000000000000009ll
#define PI acos(-1.0)
#define piii pair<int, pii>
#define CLR(aa, nnn) for(int ii = 0; ii <= nnn; ii++) {aa[ii].clear();}

using namespace std;

///******* Template ********///

template <class T> inline T bigmod(T p,T e,T M)
{
    if(e==0)return 1;
    if(e%2==0)
    {
        T t=bigmod(p,e/2,M);
        return (t*t)%M;
    }
    return (bigmod(p,e-1,M)*p)%M;
}
template <class T> inline T gcd(T a,T b)
{
    if(b==0)return a;
    return gcd(b,a%b);
}
template <class T> inline T modinverse(T a,T M)
{
    return bigmod(a,M-2,M);
}

/**
return (a * b) % m;
where a, b, m <= 10^18
**/
template <class T> inline T multimod(T a, T b, T m)
{
    T ans = 0ll;
    a%=m, b%=m;
    while(b)
    {
        if(b&1ll) ans = m - ans > a?(ans + a): (ans + a - m);
        b >>= 1ll;
        a = (m - a)>a?a+a:a+a-m;
    }
    return (T)ans;
}

void sc(int &a)
{
    scanf("%d", &a);
}

void sc(ll &a)
{
    scanf("%lld", &a);
}

void sc(double &a)
{
    scanf("%lf", &a);
}

void sc(int &a, int &b)
{
    scanf("%d %d", &a, &b);
}

void sc(ll &a, ll &b)
{
    scanf("%lld %lld", &a, &b);
}

void sc(int &a, int &b, int &c)
{
    scanf("%d %d %d", &a, &b, &c);
}

void sc(int &a, int &b, ll &c)
{
    scanf("%d %d %lld", &a, &b, &c);
}

void sc(ll &a, ll &b, ll &c)
{
    scanf("%lld %lld %lld", &a, &b, &c);
}

void sc(string &str)
{
    cin>>str;
}

void sc(char *(str))
{
    scanf(" %s", str);
}

void sc(char &c)
{
    scanf(" %c", &c);
}

///****** fast scan ends here ***********///

//int dr[] = {-1, 0, 1, 0};
//int dc[] = {0, 1, 0, -1}; /// 4 sides
//int dr[] = {-1, -1, 0, 1, 1, 1, 0, -1};
//int dc[] = {0, 1, 1, 1, 0, -1, -1, -1}; /// 8 sides

#define LEN(a) strlen(a)
#define ull unsigned long long

#define nl printf("\n")

//#define MX 10000000000000000ll
#define MX (lim*4 + 10)
#define lim 300000     /// 10^5

///***** Template ends here *****///
///********************* Code starts here ****************************

/// ********** Convex Hull Trick ********///

struct line{
	long long a , b;
	double xleft;
	bool type;
	line(long long _a , long long _b){
		a = _a;
		b = _b;
		type = 0;
	}
	bool operator < (const line &other) const{
		if(other.type){
			return xleft < other.xleft;
		}
		return a > other.a;
	}
};
double meet(line x , line y){
	return 1.0 * (y.b - x.b) / (x.a - y.a);
}
struct cht{
	set < line > hull;
	cht(){
		hull.clear();
	}
	typedef set < line > :: iterator ite;
	bool hasleft(ite node){
		return node != hull.begin();
	}
	bool hasright(ite node){
		return node != prev(hull.end());
	}
	void updateborder(ite node){
		if(hasright(node)){
			line temp = *next(node);
			hull.erase(temp);
			temp.xleft = meet(*node , temp);
			hull.insert(temp);
		}
		if(hasleft(node)){
			line temp = *node;
			temp.xleft = meet(*prev(node) , temp);
			hull.erase(node);
			hull.insert(temp);
		}
		else{
			line temp = *node;
			hull.erase(node);
			temp.xleft = -2000000000000000000LL;
			hull.insert(temp);
		}
	}
	bool useless(line left , line middle , line right){
		double x = meet(left , right);
		double y = x * middle.a + middle.b;
		double ly = left.a * x + left.b;
		return y > ly;
	}
	bool useless(ite node){
		if(hasleft(node) && hasright(node)){
			return useless(*prev(node) , *node , *next(node));
		}
		return 0;
	}
	void addline(long long m , long long c){
		line temp = line(m , c);
		auto it = hull.lower_bound(temp);
		if(it != hull.end() && it -> a == m){
			if(it -> b > c){
				hull.erase(it);
			}
			else{
				return;
			}
		}
		hull.insert(temp);
		it = hull.find(temp);
		if(useless(it)){
			hull.erase(it);
			return;
		}
		while(hasleft(it) && useless(prev(it))){
			hull.erase(prev(it));
		}
		while(hasright(it) && useless(next(it))){
			hull.erase(next(it));
		}
		updateborder(it);
	}
	long long getbest(long long x){
		if(hull.empty()){
			return 2000000000000000000LL;
		}
		line query(0 , 0);
		query.xleft = x;
		query.type = 1;
		auto it = hull.lower_bound(query);
		it = prev(it);
		return it -> a * x + it -> b;
	}
};

cht tree[MX*4];

ll m, c;

void insert(int ind, int st, int ed, int l, int r)
{
    if(st >= l && ed <= r)
    {
        tree[ind].addline(m, c);
        return;
    }
    int mid = (st + ed)/2;
    if(r <= mid)
        insert(ind*2, st, mid, l, r);
    else if(l > mid)
        insert(ind*2+1, mid+1, ed, l, r);
    else
    {
        insert(ind*2, st, mid, l, mid);
        insert(ind*2+1, mid+1, ed, mid+1, r);
    }
return;
}

ll ans, x;

void query(int ind, int st, int ed, int pos)
{
    ans = max(ans, tree[ind].getbest(x)*(-1ll));
    if(st == ed)
    {
        return;
    }
    int mid = (st + ed)/2;
    if(pos <= mid)
        query(ind*2, st, mid, pos);
    else
        query(ind*2+1, mid+1, ed, pos);
}

ll arr[MAX];
ll cc[MAX];
int type[MAX];

int nxt[MAX];

int main()
{
    int i, j, k;
    int n;

    scanf("%d", &n);

    for(i = 1; i <= n; i++)
    {
        scanf("%d %lld", &type[i], &arr[i]);
        if(type[i] == 1)
        {
            scanf("%lld", &cc[i]);
            nxt[i] = n;
        }
        else if(type[i] == 2)
        {
            nxt[ arr[i] ] = i;
        }
    }

    for(i = 1; i <= n; i++)
    {
        if(type[i] == 1)
        {
            m = -arr[i], c = -cc[i];
            insert(1, 1, n, i, nxt[i]);
        }
        else if(type[i] == 3)
        {
            x = arr[i];
            ans = -INF;
            query(1, 1, n, i);
            if(ans == -INF)
                printf("EMPTY SET\n");
            else
                printf("%lld\n", ans);
        }
    }

    return 0;
}


#include<bits/stdc++.h>

/*
 * @Author: Christopher_Liu
 * @Description: Codeforces678F Lena and Queries
 * @Date: 2019-04-20 21:23:18
 */

#define maxDeep     21
#define maxSize     300010
#define maxNode     5000001
#define LL          long long
#define match       l <= L and R <= r
#define cin(a)      scanf("%s", a)
#define ls          (i << 1)
#define rs          (i << 1 | 1)
#define lson        ls, L, mid
#define rson        rs, mid + 1, R
#define rep(a, b)   for(int i = a; i <= b; ++i)
#define Rep(a, b)   for(int j = a; j <= b; ++j)

template<typename T> T max(T a, T b) { return a > b ? a : b; }
template<typename T> T min(T a, T b) { return a > b ? b : a; }
template<typename T> void Swap(T &a, T &b) { T c = a; a = b; b = c; }
template<typename Type>
inline void read(Type &res) {
    res = 0; Type opt = 1;
    char c = getchar();
    while(!isdigit(c)) {
        if(c == '-') opt = -1;
        c = getchar();
    }
    while(isdigit(c)) {
        res = (res << 1) + (res << 3) + (c - '0');
        c = getchar();
    }
    res *= opt;
}

int n,t,x;
LL  a,b,q[maxSize],ans[maxSize];
bool vis[maxSize];

struct Point {
    LL x,y;
    bool operator < (const Point pt) const {
        return x < pt.x or (x == pt.x and y < pt.y);
    }
    Point operator - (const Point pt) const {
        return {x - pt.x, y - pt.y};
    }
    LL    operator * (const Point pt) const {
        return x * pt.y - pt.x * y;
    }
};

struct {
    Point pt;
    int appear,disappear;
}qu[maxSize];

class ConvexHull {
    public:
        int top;
        Point stack[maxSize];

        void insert(Point pt) {
            while(top > 1 and (pt - stack[top]) * (stack[top] - stack[top - 1]) <= 0) --top;
            stack[++top] = pt;
        }

        LL dot(Point pt, LL val) {
            return val * pt.x + pt.y;
        }

        LL query(LL val) {
            if(top == 0) return -(LL)(3e18);
            int l = 1,r = top;
            while(l < r) {
                int mid = (l + r) >> 1;
                if(dot(stack[mid], val) <= dot(stack[mid + 1], val)) l = mid + 1;
                else r = mid;
            }
            return dot(stack[l], val);
        }
};

ConvexHull      convexhull[maxDeep];

class SegmentTree {
    public:
        struct {
            std::vector<Point>ptList;
        }tree[maxSize << 2];

        void insert(int i, int L, int R, int l, int r, Point pt) {
            if(l > r or L > R) return;
            if(match) {
                tree[i].ptList.push_back(pt);
            } else {
                int mid = (L + R) >> 1;
                if(l <= mid) insert(lson, l, r, pt);
                if(r > mid)  insert(rson, l, r, pt);
            }
        }

        void solve(int i, int L, int R, int deep) {
            if(L > R) return;
            convexhull[deep].top = 0;
            std::sort(tree[i].ptList.begin(), tree[i].ptList.end());
            for(auto pt : tree[i].ptList) {
                convexhull[deep].insert(pt);
            }
            if(L == R) {
                ans[L] = max(ans[L], convexhull[deep].query(q[L]));
                if(ans[L] == -(LL)(3e18)) puts("EMPTY SET");
                else printf("%lld\n", ans[L]);
            } else {
                rep(L, R) {
                    ans[i] = max(ans[i], convexhull[deep].query(q[i]));
                }
                int mid = (L + R) >> 1;
                solve(lson, deep + 1);
                solve(rson, deep + 1);
            }
        }
};

SegmentTree         segtree;

int main() {
    read(n);
    int queryId = 0;
    rep(1, n) {
        read(t);
        if(t == 1) {
            vis[i] = true;
            read(qu[i].pt.x); read(qu[i].pt.y);
            qu[i].appear = queryId + 1;
            qu[i].disappear = -1;
        } else if(t == 2) {
            read(x);
            qu[x].disappear = queryId;
        } else {
            read(q[++queryId]);
            ans[queryId] = -(LL)(3e18);
        }
    }
    rep(1, n) {
        if(!vis[i]) continue;
        if(qu[i].disappear == -1) qu[i].disappear = queryId;
        segtree.insert(1, 1, queryId, qu[i].appear, qu[i].disappear, qu[i].pt);
    }
    segtree.solve(1, 1, queryId, 0);
    return 0;
}


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

typedef long long LL ;
typedef pair < int , int > pii ;

#define getid( l , r ) l + r | ( l != r )

const int MAXN = 300005 ;
const int DEL = 1e9 + 7 ;
const LL INF = 2e18 ;

vector < pii > T[MAXN << 1] ;
pii seg[MAXN] , op[MAXN] ;
int n , cnt ;

void add ( int L , int R , pii& t , int l , int r ) {
	int o = getid ( l , r ) , m = l + r >> 1 ;
	if ( L <= l && r <= R ) T[o].push_back ( t ) ;
	else {
		if ( L <= m ) add ( L , R , t , l , m ) ;
		if ( m <  R ) add ( L , R , t , m + 1 , r ) ;
	}
}

int check ( pii& i , pii& j , pii& k ) {
	return 1LL * ( i.second - j.second ) * ( k.first - i.first ) >= 1LL * ( i.second - k.second ) * ( j.first - i.first ) ;
}

void calc ( vector < pii >& T ) {
	static int S[MAXN] , i , t ;
	sort ( T.begin () , T.end () ) ;
	for ( i = 0 , t = 0 ; i < T.size () ; ++ i ) {
		while ( t && T[S[t]].first == T[i].first || t > 1 && check ( T[S[t - 1]] , T[S[t]] , T[i] ) ) -- t ;
		S[++ t] = i ;
	}
	vector < pii > nxt ;
	for ( i = 1 ; i <= t ; ++ i ) {
		nxt.push_back ( T[S[i]] ) ;
	}
	T = nxt ;
}

LL func ( int k , int b , int x ) {
	return 1LL * k * x + b ;
}

LL get_max_val ( int x , int o ) {
	if ( !T[o].size () ) return -INF ;
	int l = 0 , r = T[o].size () - 1 ;
	while ( l < r ) {
		int m = l + r >> 1 ;
		if ( func ( T[o][m].first , T[o][m].second , x ) > func ( T[o][m + 1].first , T[o][m + 1].second , x ) ) r = m ;
		else l = m + 1 ;
	}
	return func ( T[o][l].first , T[o][l].second , x ) ;
}

LL query ( int x , int pos , int l , int r ) {
	LL res = -INF ;
	while ( l < r ) {
		int o = getid ( l , r ) , m = l + r >> 1 ;
		res = max ( res , get_max_val ( x , o ) ) ;
		if ( pos <= m ) r = m ;
		else l = m + 1 ;
	}
	res = max ( res , get_max_val ( x , getid ( l , r ) ) ) ;
	return res ;
}

void solve () {
	cnt = 0 ;
	for ( int i = 1 ; i <= n << 1 ; ++ i ) T[i].clear () ;
	for ( int i = 1 , c ; i <= n ; ++ i ) {
		scanf ( "%d%d" , &c , &seg[i].first ) ;
		if ( c == 1 ) scanf ( "%d" , &seg[i].second ) ;
		else if ( c == 2 ) {
			int x = seg[i].first ;
			add ( x , i , seg[x] , 1 , n ) ;
			seg[x].first = seg[i].first = DEL ;
		} else op[++ cnt] = pii ( seg[i].first , i ) , seg[i].first = DEL ;
	}
	for ( int i = 1 ; i <= n ; ++ i ) {
		if ( seg[i].first != DEL ) add ( i , n , seg[i] , 1 , n ) ;
	}
	for ( int i = 1 ; i <= n << 1 ; ++ i ) if ( T[i].size () ) {
		calc ( T[i] ) ;
	}
	for ( int i = 1 ; i <= cnt ; ++ i ) {
		LL res = query ( op[i].first , op[i].second , 1 , n ) ;
		if ( res == -INF ) printf ( "EMPTY SET\n" ) ;
		else printf ( "%lld\n" , res ) ;
	}
}

int main () {
	while ( ~scanf ( "%d" , &n ) ) solve () ;
	return 0 ;
}


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

typedef long long LL ;
typedef pair < int , int > pii ;

#define getid( l , r ) l + r | ( l != r )

const int MAXN = 300005 ;
const int DEL = 1e9 + 7 ;
const LL INF = 2e18 ;

struct Line {
	int k , b ;
	Line () {}
	Line ( int k , int b ) : k ( k ) , b ( b ) {}
	LL f ( int x ) {
		return 1LL * k * x + b ;
	}
	bool operator < ( const Line& a ) const {
		return k != a.k ? k < a.k : b < a.b ;
	}
} ;

vector < Line > T[MAXN << 1] ;
pii seg[MAXN] , op[MAXN] ;
int n , cnt ;

void add ( int L , int R , int k , int b , int l , int r ) {
	int o = getid ( l , r ) , m = l + r >> 1 ;
	if ( L <= l && r <= R ) T[o].push_back ( Line ( k , b ) ) ;
	else {
		if ( L <= m ) add ( L , R , k , b , l , m ) ;
		if ( m <  R ) add ( L , R , k , b , m + 1 , r ) ;
	}
}

int check ( vector < Line >& a , int i , int j , int k ) {
	return 1LL * ( a[i].b - a[j].b ) * ( a[k].k - a[i].k ) >= 1LL * ( a[i].b - a[k].b ) * ( a[j].k - a[i].k ) ;
}

void calc ( vector < Line >& T ) {
	static int S[MAXN] , i , t ;
	sort ( T.begin () , T.end () ) ;
	for ( i = 0 , t = 0 ; i < T.size () ; ++ i ) {
		while ( t && T[S[t]].k == T[i].k || t > 1 && check ( T , S[t - 1] , S[t] , i ) ) -- t ;
		S[++ t] = i ;
	}
	vector < Line > nxt ;
	for ( i = 1 ; i <= t ; ++ i ) {
		nxt.push_back ( T[S[i]] ) ;
	}
	T = nxt ;
}

LL get_max_val ( int x , int o ) {
	if ( !T[o].size () ) return -INF ;
	int l = 0 , r = T[o].size () - 1 ;
	while ( l < r ) {
		int m = l + r >> 1 ;
		if ( T[o][m].f ( x ) > T[o][m + 1].f ( x ) ) r = m ;
		else l = m + 1 ;
	}
	return T[o][l].f ( x ) ;
}

LL query ( int x , int pos , int l , int r ) {
	LL res = -INF ;
	while ( l < r ) {
		int o = getid ( l , r ) , m = l + r >> 1 ;
		res = max ( res , get_max_val ( x , o ) ) ;
		if ( pos <= m ) r = m ;
		else l = m + 1 ;
	}
	res = max ( res , get_max_val ( x , getid ( l , r ) ) ) ;
	return res ;
}

void solve () {
	cnt = 0 ;
	for ( int i = 1 ; i <= n << 1 ; ++ i ) T[i].clear () ;
	for ( int i = 1 , c ; i <= n ; ++ i ) {
		scanf ( "%d%d" , &c , &seg[i].first ) ;
		if ( c == 1 ) scanf ( "%d" , &seg[i].second ) ;
		else if ( c == 2 ) {
			int x = seg[i].first ;
			add ( x , i , seg[x].first , seg[x].second , 1 , n ) ;
			seg[x].first = seg[i].first = DEL ;
		} else op[++ cnt] = pii ( seg[i].first , i ) , seg[i].first = DEL ;
	}
	for ( int i = 1 ; i <= n ; ++ i ) {
		if ( seg[i].first != DEL ) add ( i , n , seg[i].first , seg[i].second , 1 , n ) ;
	}
	for ( int i = 1 ; i <= n << 1 ; ++ i ) if ( T[i].size () ) {
		calc ( T[i] ) ;
	}
	for ( int i = 1 ; i <= cnt ; ++ i ) {
		LL res = query ( op[i].first , op[i].second , 1 , n ) ;
		if ( res == -INF ) printf ( "EMPTY SET\n" ) ;
		else printf ( "%lld\n" , res ) ;
	}
}

int main () {
	while ( ~scanf ( "%d" , &n ) ) solve () ;
	return 0 ;
}


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

typedef long long LL ;
typedef pair < int , int > pii ;

#define getid( l , r ) l + r | ( l != r )

const int MAXN = 300005 ;
const int DEL = 1e9 + 7 ;
const LL INF = 2e18 ;

struct Line {
	int k , b ;
	Line () {}
	Line ( int k , int b ) : k ( k ) , b ( b ) {}
	LL f ( int x ) {
		return 1LL * k * x + b ;
	}
	bool operator < ( const Line& a ) const {
		return k != a.k ? k < a.k : b < a.b ;
	}
} ;

vector < Line > T[MAXN << 1] ;
pii seg[MAXN] , op[MAXN] ;
int n , cnt ;

void add ( int L , int R , int k , int b , int l , int r ) {
	int o = getid ( l , r ) , m = l + r >> 1 ;
	if ( L <= l && r <= R ) T[o].push_back ( Line ( k , b ) ) ;
	else {
		if ( L <= m ) add ( L , R , k , b , l , m ) ;
		if ( m <  R ) add ( L , R , k , b , m + 1 , r ) ;
	}
}

int check ( vector < Line >& a , int i , int j , int k ) {
	return 1LL * ( a[i].b - a[j].b ) * ( a[k].k - a[i].k ) >= 1LL * ( a[i].b - a[k].b ) * ( a[j].k - a[i].k ) ;
}

void calc ( vector < Line >& T ) {
	static int S[MAXN] ;
	sort ( T.begin () , T.end () ) ;
	for ( int i = 0 , t = 0 ; i < T.size () ; ++ i ) {
		while ( t && T[S[t]].k == T[i].k || t > 1 && check ( T , S[t - 1] , S[t] , i ) ) -- t ;
		S[++ t] = i ;
	}
}

LL get_max_val ( int x , int o ) {
	if ( !T[o].size () ) return -INF ;
	int l = 0 , r = T[o].size () - 1 ;
	while ( l < r ) {
		int m = l + r >> 1 ;
		if ( T[o][m].f ( x ) > T[o][m + 1].f ( x ) ) r = m ;
		else l = m + 1 ;
	}
	return T[o][l].f ( x ) ;
}

LL query ( int x , int pos , int l , int r ) {
	LL res = -INF ;
	while ( l < r ) {
		int o = getid ( l , r ) , m = l + r >> 1 ;
		res = max ( res , get_max_val ( x , o ) ) ;
		if ( pos <= m ) r = m ;
		else l = m + 1 ;
	}
	res = max ( res , get_max_val ( x , getid ( l , r ) ) ) ;
	return res ;
}

void solve () {
	cnt = 0 ;
	for ( int i = 1 ; i <= n << 1 ; ++ i ) T[i].clear () ;
	for ( int i = 1 , c ; i <= n ; ++ i ) {
		scanf ( "%d%d" , &c , &seg[i].first ) ;
		if ( c == 1 ) scanf ( "%d" , &seg[i].second ) ;
		else if ( c == 2 ) {
			int x = seg[i].first ;
			add ( x , i , seg[x].first , seg[x].second , 1 , n ) ;
			seg[x].first = seg[i].first = DEL ;
		} else op[++ cnt] = pii ( seg[i].first , i ) , seg[i].first = DEL ;
	}
	for ( int i = 1 ; i <= n ; ++ i ) {
		if ( seg[i].first != DEL ) add ( i , n , seg[i].first , seg[i].second , 1 , n ) ;
	}
	for ( int i = 1 ; i <= n << 1 ; ++ i ) if ( T[i].size () ) {
		calc ( T[i] ) ;
	}
	for ( int i = 1 ; i <= cnt ; ++ i ) {
		LL res = query ( op[i].first , op[i].second , 1 , n ) ;
		if ( res == -INF ) printf ( "EMPTY SET\n" ) ;
		else printf ( "%lld\n" , res ) ;
	}
}

int main () {
	while ( ~scanf ( "%d" , &n ) ) solve () ;
	return 0 ;
}


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

using ll = long long;

const ll inf = 2e18;
const int N = 1400000;

struct line{
	ll a, b;
	line(ll a = 0, ll b = -inf) : a(a), b(b) {}
	ll getValue(ll x) { return a * x + b; }
} L[N];

int qx[N];

void add(int u, int l, int r, line li) {
	int m = l + r >> 1;
	bool lef = L[u].getValue(qx[l]) < li.getValue(qx[l]);
	bool mid = L[u].getValue(qx[m]) < li.getValue(qx[m]);
	if (mid) swap(L[u], li);
	if (r - l == 1) return;
	if (lef == mid) add(u+u+1, m, r, li);
	else add(u+u, l, m, li);
}

ll get(int u, int l, int r, int i) {
	ll ret = L[u].getValue(qx[i]);
	int m = l + r >> 1;
	if (r - l == 1) return ret;
	if (i < m) return max(ret, get(u+u, l, m, i));
	return max(ret, get(u+u+1, m, r, i));
}

int type[N], a[N], b[N], nxt[N], prv[N];
ll ans[N];

ll solve(int l, int r) {
	int m = l + r >> 1;
	if (r - l > 1) {
		solve(l, m);
		solve(m, r);
	}
	int qn = 0;
	for (int i = m; i < r; i++) {
		if (type[i] == 3) qx[qn++] = a[i];
	}
	sort(qx, qx + qn);
	qn = unique(qx, qx + qn) - qx;
	for (int i = 0; i <= (qn<<2); i++) L[i] = line(0, -inf);
	for (int i = l; i < m; i++) {
		if (type[i] == 1 && nxt[i] >= r) add(1, 0, qn, line(a[i], b[i]));
	}
	for (int i = r-1; i >= m; i--) {
		if (type[i] == 2 && l <= prv[i] && prv[i] < m) {
			add(1, 0, qn, line(a[prv[i]], b[prv[i]]));
		}
		if (type[i] == 3) {
			ans[i] = max(ans[i], get(1, 0, qn, lower_bound(qx, qx + qn, a[i]) - qx));
		}
	}
}

int main() {
	ios_base::sync_with_stdio(0);
	cin.tie(0), cout.tie(0);
	int n; cin >> n;
	for (int i = 1; i <= n; i++) nxt[i] = n+1;
	for (int i = 1; i <= n; i++) {
		cin >> type[i];
		if (type[i] == 1) cin >> a[i] >> b[i];
		if (type[i] == 2) {
			cin >> prv[i];
			nxt[prv[i]] = i;
		}
		if (type[i] == 3) cin >> a[i];
		ans[i] = -inf;
	}
	solve(1, n+1);
	for (int i = 1; i <= n; i++) {
		if (type[i] == 3) {
			if (ans[i] == -inf) cout << "EMPTY SET" << endl;
			else cout << ans[i] << endl;
		}
	}
}


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

using ll = long long;

const ll inf = 2e18;
const int N = 1400000;

struct line{
	ll a, b;
	line(ll a = 0, ll b = -inf) : a(a), b(b) {}
	ll getValue(ll x) { return a * x + b; }
} L[N];

int qx[N];

void add(int u, int l, int r, line li) {
	int m = l + r >> 1;
	bool lef = L[u].getValue(qx[l]) < li.getValue(qx[l]);
	bool mid = L[u].getValue(qx[m]) < li.getValue(qx[m]);
	if (mid) swap(L[u], li);
	if (r - l == 1) return;
	if (lef == mid) add(u+u+1, m, r, li);
	else add(u+u, l, m, li);
}

ll get(int u, int l, int r, int i) {
	ll ret = L[u].getValue(qx[i]);
	int m = l + r >> 1;
	if (r - l == 1) return ret;
	if (i < m) return max(ret, get(u+u, l, m, i));
	return max(ret, get(u+u+1, m, r, i));
}

int type[N], a[N], b[N], nxt[N], prv[N];
ll ans[N];

void solve(int l, int r) {
	int m = l + r >> 1;
	if (r - l > 1) {
		solve(l, m);
		solve(m, r);
	}
	int qn = 0;
	for (int i = m; i < r; i++) {
		if (type[i] == 3) qx[qn++] = a[i];
	}
	if (!qn) return;
	sort(qx, qx + qn);
	qn = unique(qx, qx + qn) - qx;
	for (int i = 0; i <= (qn<<2); i++) L[i] = line(0, -inf);
	for (int i = l; i < m; i++) {
		if (type[i] == 1 && nxt[i] >= r) add(1, 0, qn, line(a[i], b[i]));
	}
	for (int i = r-1; i >= m; i--) {
		if (type[i] == 2 && l <= prv[i] && prv[i] < m) {
			add(1, 0, qn, line(a[prv[i]], b[prv[i]]));
		}
		if (type[i] == 3) {
			ans[i] = max(ans[i], get(1, 0, qn, lower_bound(qx, qx + qn, a[i]) - qx));
		}
	}
}

int main() {
	ios_base::sync_with_stdio(0);
	cin.tie(0), cout.tie(0);
	int n; cin >> n;
	for (int i = 1; i <= n; i++) nxt[i] = n+1;
	for (int i = 1; i <= n; i++) {
		cin >> type[i];
		if (type[i] == 1) cin >> a[i] >> b[i];
		if (type[i] == 2) {
			cin >> prv[i];
			nxt[prv[i]] = i;
		}
		if (type[i] == 3) cin >> a[i];
		ans[i] = -inf;
	}
	solve(1, n+1);
	for (int i = 1; i <= n; i++) {
		if (type[i] == 3) {
			if (ans[i] == -inf) cout << "EMPTY SET" << endl;
			else cout << ans[i] << endl;
		}
	}
}


#include <bits/stdc++.h>
using namespace std;
#define Inf 5e18
#define N 300010
#define int long long
struct node{
    int x,y,id;
    bool operator<(const node &a) const {
        return x<a.x || x==a.x && y<a.y;
    }
}s[N];
int Q[N],op[N],ed[N],st[N],ans[N],X[N];
int multi(node a,node b,node o){
    return (o.y-b.y)*(o.x-a.x)-(o.y-a.y)*(o.x-b.x);
}
int query(int x,int n){
    if (!n) return -Inf;
    int l=1,r=n,ans=n;
    while (l<=r){
        int mid=l+r>>1;
        if (x*s[Q[mid]].x+s[Q[mid]].y>x*s[Q[mid+1]].x+s[Q[mid+1]].y)ans=mid,r=mid-1;
        else l=mid+1;
    }
    return x*s[Q[ans]].x+s[Q[ans]].y;
}
void getans(int l,int r,int n){
    for (int i=l;i<=r;i++) if (op[s[i].id]==3){
        ans[s[i].id]=max(ans[s[i].id],query(X[s[i].id],n));
    }
}
void CDQ(int l,int r){
    if (l==r) return; int mid=l+r>>1;
    CDQ(l,mid); CDQ(mid+1,r);
    sort(s+l,s+mid+1);
    int t=0;
    for (int i=l;i<=mid;i++){
        if (op[s[i].id]!=1 || ed[s[i].id]<=r) continue;
        while (t>=2 && multi(s[Q[t-1]],s[Q[t]],s[i])>=0) t--;
        Q[++t]=i;
    }
    getans(mid+1,r,t);
    t=0;
    sort(s+mid+1,s+r+1);
    for (int i=mid+1;i<=r;i++){
        if (op[s[i].id]!=2 || st[s[i].id]>=l) continue;
        while (t>=2 && multi(s[Q[t-1]],s[Q[t]],s[i])>=0) t--;
        Q[++t]=i;
    }
    getans(l,mid,t);
}
signed main(){
    int n; scanf("%lld",&n);
    for (int i=1;i<=n;i++){
        ans[i]=-Inf;
        scanf("%lld",&op[i]); s[i].id=i;
        if (op[i]==1){
            scanf("%lld%lld",&s[i].x,&s[i].y);
            ed[i]=n+1;
        }else if (op[i]==2){
            int x; scanf("%lld",&x);
            s[i].x=s[x].x; s[i].y=s[x].y;
            ed[x]=i; st[i]=x;
        }else scanf("%lld",&X[i]);
    }
    CDQ(1,n);
    for (int i=1;i<=n;i++)
        if (op[i]==3){
            if (ans[i]==-Inf) puts("EMPTY SET");
            else printf("%lld\n",ans[i]);
        }
    return 0;
}


#include <bits/stdc++.h>
using namespace std;
#define Inf 1e18
#define N 300010
#define int long long
struct node{
    int x,y,id;
    bool operator<(const node &a) const {
        return x<a.x || x==a.x && y<a.y;
    }
}s[N];
int Q[N],op[N],ed[N],st[N],ans[N],X[N];
int multi(node a,node b,node o){
    return (o.y-b.y)*(o.x-a.x)-(o.y-a.y)*(o.x-b.x);
}
int query(int x,int n){
    if (!n) return -Inf;
    int l=1,r=n,ans=n;
    while (l<=r){
        int mid=l+r>>1;
        if (x*s[Q[mid]].x+s[Q[mid]].y>x*s[Q[mid+1]].x+s[Q[mid+1]].y)ans=mid,r=mid-1;
        else l=mid+1;
    }
    return x*s[Q[ans]].x+s[Q[ans]].y;
}
void getans(int l,int r,int n){
    for (int i=l;i<=r;i++) if (op[s[i].id]==3){
        ans[s[i].id]=max(ans[s[i].id],query(X[s[i].id],n));
    }
}
void CDQ(int l,int r){
    if (l==r) return; int mid=l+r>>1;
    CDQ(l,mid); CDQ(mid+1,r);
    sort(s+l,s+mid+1);
    int t=0;
    for (int i=l;i<=mid;i++){
        if (op[s[i].id]!=1 || ed[s[i].id]<=r) continue;
        while (t>=2 && multi(s[Q[t-1]],s[Q[t]],s[i])>=0) t--;
        Q[++t]=i;
    }
    getans(mid+1,r,t);
    t=0;
    sort(s+mid+1,s+r+1);
    for (int i=mid+1;i<=r;i++){
        if (op[s[i].id]!=2 || st[s[i].id]>=l) continue;
        while (t>=2 && multi(s[Q[t-1]],s[Q[t]],s[i])>=0) t--;
        Q[++t]=i;
    }
    getans(l,mid,t);
}
signed main(){
    int n; scanf("%lld",&n);
    for (int i=1;i<=n;i++){
        ans[i]=-Inf;
        scanf("%lld",&op[i]); s[i].id=i;
        if (op[i]==1){
            scanf("%lld%lld",&s[i].x,&s[i].y);
            ed[i]=n+1;
        }else if (op[i]==2){
            int x; scanf("%lld",&x);
            s[i].x=s[x].x; s[i].y=s[x].y;
            ed[x]=i; st[i]=x;
        }else scanf("%lld",&X[i]);
    }
    CDQ(1,n);
    for (int i=1;i<=n;i++)
        if (op[i]==3){
            if (ans[i]==-Inf) puts("EMPTY SET");
            else printf("%lld\n",ans[i]);
        }
    return 0;
}


#include <bits/stdc++.h>
using namespace std;
#define Inf 1e18
#define N 300010
#define int long long
struct node{
    int x,y,id;
    bool operator<(const node &a) const {
        return x<a.x || x==a.x && y<a.y;
    }
}s[N];
int Q[N],op[N],ed[N],st[N],ans[N],X[N];
int multi(node a,node b,node o){
    return (o.y-b.y)*(o.x-a.x)-(o.y-a.y)*(o.x-b.x);
}
int query(int x,int n){
    if (!n) return -Inf;
    int l=1,r=n,ans=0;
    while (l<=r){
        int mid=l+r>>1;
        if (x*s[Q[mid]].x+s[Q[mid]].y>x*s[Q[mid+1]].x+s[Q[mid+1]].y)ans=mid,r=mid-1;
        else l=mid+1;
    }
    return x*s[Q[ans]].x+s[Q[ans]].y;
}
void getans(int l,int r,int n){
    for (int i=l;i<=r;i++) if (op[s[i].id]==3){
        ans[s[i].id]=max(ans[s[i].id],query(X[s[i].id],n));
    }
}
void CDQ(int l,int r){
    if (l==r) return; int mid=l+r>>1;
    CDQ(l,mid); CDQ(mid+1,r);
    sort(s+l,s+mid+1);
    int t=0;
    for (int i=l;i<=mid;i++){
        if (op[s[i].id]!=1 || ed[s[i].id]<=r) continue;
        while (t>=2 && multi(s[Q[t-1]],s[Q[t]],s[i])>=0) t--;
        Q[++t]=i;
    }
    getans(mid+1,r,t);
    t=0;
    sort(s+mid+1,s+r+1);
    for (int i=mid+1;i<=r;i++){
        if (op[s[i].id]!=2 || st[s[i].id]>=l) continue;
        while (t>=2 && multi(s[Q[t-1]],s[Q[t]],s[i])>=0) t--;
        Q[++t]=i;
    }
    getans(l,mid,t);
}
signed main(){
    int n; scanf("%lld",&n);
    for (int i=1;i<=n;i++){
        ans[i]=-Inf;
        scanf("%lld",&op[i]); s[i].id=i;
        if (op[i]==1){
            scanf("%lld%lld",&s[i].x,&s[i].y);
            ed[i]=n+1;
        }else if (op[i]==2){
            int x; scanf("%lld",&x);
            s[i].x=s[x].x; s[i].y=s[x].y;
            ed[x]=i; st[i]=x;
        }else scanf("%lld",&X[i]);
    }
    CDQ(1,n);
    for (int i=1;i<=n;i++)
        if (op[i]==3){
            if (ans[i]==-Inf) puts("EMPTY SET");
            else printf("%lld\n",ans[i]);
        }
    return 0;
}


#include <vector>
#include <list>
#include <map>
#include <set>
#include <deque>
#include <queue>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <string>
#include <cstring>
#include <ctime>

#include <fstream>

using namespace std;

#define LL long long
#define N 500005
#define M 4000100
#define MP make_pair
#define Pi acos(-1.0)
//#pradisma comment(linker,"/STACK:1024000000,1024000000")
#define ls (rt << 1)
#define rs (ls | 1)
#define md ((ll+rr)/2)
#define lson ls, ll, md
#define rson rs, md+1, rr
#define mod 1000000007
#define inf 0x3f3f3f3f
const LL INF = 1LL<<62;
#define sqr(x) ((x)*(x))
#define eps 1e-9
#define uLL unsidisned londis londis
#define ui unsidisned int
LL powmod(LL a,LL b) {LL res=1;a%=mod;for(;b;b>>=1){if(b&1)res=res*a%mod;a=a*a%mod;}return res;}
#define F(x) ((x)/3+((x)%3 == 1 ? 0 : tb))
#define dis(x) ((x)<tb ? (x)*3+1 : ((x) - tb)*3+2)
#define lowbit(x) ((x)&(-x))
#define fi first
#define se second
#define pii pair<int,int>
#define pli pair<LL,int>
#define pll pair<LL,LL>
#define PB push_back
#define mp make_pair
#define SZ(x) x.size()

template<typename T> inline bool chkmin(T &a, const T &b) { return a > b ? a = b, 1 : 0; }
template<typename T> inline bool chkmax(T &a, const T &b) { return a < b ? a = b, 1 : 0; }

int read()
{
    int x=0,f=1;char ch=getchar();
    while(ch<'0'||ch>'9'){if(ch=='-')f=-1;ch=getchar();}
    while(ch>='0'&&ch<='9'){x=x*10+ch-'0';ch=getchar();}
    return x*f;
}

vector< pii > t[N << 2];
int n, op[N], a[N], b[N], c[N];

void insert(int rt, int ll, int rr, int l, int r, pii x)
{

    if(ll == l && rr == r)
    {
        t[rt].PB(x);
        return ;
    }

    if(r <= md)
        insert(lson, l, r, x);
    else if(l > md)
        insert(rson, l, r, x);
    else
        insert(lson, l, md, x), insert(rson, md + 1, r, x);

}

LL ans;
bool vis[N << 2];

LL cross(pii &a, pii &b, pii &c)
{
    return 1LL * (b.fi - a.fi) * (c.se - a.se) - 1LL * (c.fi - a.fi) * (b.se - a.se);
}

LL f(pii &a, int p)
{
    return 1LL * p * a.fi + a.se;
}

void query(int rt, vector< pii > &t, int p)
{
    if(SZ(t) == 0) return;

    if(!vis[rt])
    {
        vis[rt] = true;
        sort(t.begin(), t.end());
        vector< pii > tmp;
        for(int i = 0; i < SZ(t); i++)
        {
            int now;
            while((now = SZ(tmp)) >= 2 && cross(tmp[now - 2], tmp[now - 1], t[i]) >= 0) tmp.pop_back();
            tmp.PB(t[i]);
        }
        t = tmp;
    }

    int l = 0, r = SZ(t) - 1, res = SZ(t) - 1;

    while(l <= r)
    {
        int mid = (l + r) >> 1;
        if(mid == SZ(t) - 1) break;
        if(f(t[mid], p) >= f(t[mid + 1], p)) res = mid, r = mid - 1;
        else l = mid + 1;
    }

    chkmax(ans, f(t[res], p));

}

void query(int rt, int ll, int rr, int x, int p)
{
    query(rt, t[rt], p);
    if(ll == rr) return;
    if(x <= md) query(lson, x, p);
    if(x > md) query(rson , x, p);
}

int main()
{
    n = read();

    for(int i = 1; i <= n; i++)
    {
        op[i] = read();
        if(op[i] == 1)
        {
            a[i] = read(), b[i] = read();
            c[i] = n;
        }
        else if(op[i] == 2)
        {
            a[i] = read();
            c[a[i]] = i;
        }
        else
        {
            a[i] = read();
        }
    }

    for(int i = 1; i <= n; i++)
        if(op[i] == 1) insert(1, 1, n, i, c[i], MP(a[i], b[i]));

    for(int i = 1; i <= n; i++)
        if(op[i] == 3)
        {
            ans = -INF;
            query(1, 1, n, i, a[i]);
            if(ans == -INF) puts("EMPTY SET");
            else printf("%lld\n",ans);
        }

    return 0;
}


#include <vector>
#include <list>
#include <map>
#include <set>
#include <deque>
#include <queue>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <string>
#include <cstring>
#include <ctime>

#include <fstream>

using namespace std;

#define LL long long
#define N 500005
#define M 4000100
#define MP make_pair
#define Pi acos(-1.0)
//#pradisma comment(linker,"/STACK:1024000000,1024000000")
#define ls (rt << 1)
#define rs (ls | 1)
#define md ((ll+rr)/2)
#define lson ls, ll, md
#define rson rs, md+1, rr
#define mod 1000000007
#define inf 0x3f3f3f3f
const LL INF = 1e18 + 10;
#define sqr(x) ((x)*(x))
#define eps 1e-9
#define uLL unsidisned londis londis
#define ui unsidisned int
LL powmod(LL a,LL b) {LL res=1;a%=mod;for(;b;b>>=1){if(b&1)res=res*a%mod;a=a*a%mod;}return res;}
#define F(x) ((x)/3+((x)%3 == 1 ? 0 : tb))
#define dis(x) ((x)<tb ? (x)*3+1 : ((x) - tb)*3+2)
#define lowbit(x) ((x)&(-x))
#define fi first
#define se second
#define pii pair<int,int>
#define pli pair<LL,int>
#define pll pair<LL,LL>
#define PB push_back
#define mp make_pair
#define SZ(x) x.size()

template<typename T> inline bool chkmin(T &a, const T &b) { return a > b ? a = b, 1 : 0; }
template<typename T> inline bool chkmax(T &a, const T &b) { return a < b ? a = b, 1 : 0; }

int read()
{
    int x=0,f=1;char ch=getchar();
    while(ch<'0'||ch>'9'){if(ch=='-')f=-1;ch=getchar();}
    while(ch>='0'&&ch<='9'){x=x*10+ch-'0';ch=getchar();}
    return x*f;
}

vector< pii > t[N << 2];
int n, op[N], a[N], b[N], c[N];

void insert(int rt, int ll, int rr, int l, int r, pii x)
{

    if(ll == l && rr == r)
    {
        t[rt].PB(x);
        return ;
    }

    if(r <= md)
        insert(lson, l, r, x);
    else if(l > md)
        insert(rson, l, r, x);
    else
        insert(lson, l, md, x), insert(rson, md + 1, r, x);

}

LL ans;
bool vis[N << 2];

LL cross(pii &a, pii &b, pii &c)
{
    return 1LL * (b.fi - a.fi) * (c.se - a.se) - 1LL * (c.fi - a.fi) * (b.se - a.se);
}

LL f(pii &a, int p)
{
    return 1LL * p * a.fi + a.se;
}

void query(int rt, vector< pii > &t, int p)
{
    if(SZ(t) == 0) return;

    if(!vis[rt])
    {
        vis[rt] = true;
        sort(t.begin(), t.end());
        vector< pii > tmp;
        for(int i = 0; i < SZ(t); i++)
        {
            int now;
            while((now = SZ(tmp)) >= 2 && cross(tmp[now - 2], tmp[now - 1], t[i])) tmp.pop_back();
            tmp.PB(t[i]);
        }
        t = tmp;
    }

    int l = -1, r = SZ(t) - 1, res = SZ(t) - 1;

    while(l + 1 < r)
    {
        int mid = (l + r) >> 1;
        if(mid == SZ(t) - 1) break;
        if(f(t[mid], p) >= f(t[mid + 1], p)) r = mid;
        else l = mid;
    }

    chkmax(ans, f(t[r], p));

}

void query(int rt, int ll, int rr, int x, int p)
{
    query(rt, t[rt], p);
    if(ll == rr) return;
    if(x <= md) query(lson, x, p);
    if(x > md) query(rson , x, p);
}

int main()
{
    n = read();

    for(int i = 1; i <= n; i++)
    {
        op[i] = read();
        if(op[i] == 1)
        {
            a[i] = read(), b[i] = read();
            c[i] = n;
        }
        else if(op[i] == 2)
        {
            a[i] = read();
            c[a[i]] = i;
        }
        else
        {
            a[i] = read();
        }
    }

    for(int i = 1; i <= n; i++)
        if(op[i] == 1) insert(1, 1, n, i, c[i], MP(a[i], b[i]));

    for(int i = 1; i <= n; i++)
        if(op[i] == 3)
        {
            ans = -INF;
            query(1, 1, n, i, a[i]);
            if(ans == -INF) puts("EMPTY SET");
            else printf("%lld\n",ans);
        }

    return 0;
}


#include <vector>
#include <list>
#include <map>
#include <set>
#include <deque>
#include <queue>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <string>
#include <cstring>
#include <ctime>

#include <fstream>

using namespace std;

#define LL long long
#define N 500005
#define M 4000100
#define MP make_pair
#define Pi acos(-1.0)
//#pradisma comment(linker,"/STACK:1024000000,1024000000")
#define ls (rt << 1)
#define rs (ls | 1)
#define md ((ll+rr)/2)
#define lson ls, ll, md
#define rson rs, md+1, rr
#define mod 1000000007
#define inf 0x3f3f3f3f
const LL INF = 1e18 + 10;
#define sqr(x) ((x)*(x))
#define eps 1e-9
#define uLL unsidisned londis londis
#define ui unsidisned int
LL powmod(LL a,LL b) {LL res=1;a%=mod;for(;b;b>>=1){if(b&1)res=res*a%mod;a=a*a%mod;}return res;}
#define F(x) ((x)/3+((x)%3 == 1 ? 0 : tb))
#define dis(x) ((x)<tb ? (x)*3+1 : ((x) - tb)*3+2)
#define lowbit(x) ((x)&(-x))
#define fi first
#define se second
#define pii pair<int,int>
#define pli pair<LL,int>
#define pll pair<LL,LL>
#define PB push_back
#define mp make_pair
#define SZ(x) x.size()

template<typename T> inline bool chkmin(T &a, const T &b) { return a > b ? a = b, 1 : 0; }
template<typename T> inline bool chkmax(T &a, const T &b) { return a < b ? a = b, 1 : 0; }

int read()
{
    int x=0,f=1;char ch=getchar();
    while(ch<'0'||ch>'9'){if(ch=='-')f=-1;ch=getchar();}
    while(ch>='0'&&ch<='9'){x=x*10+ch-'0';ch=getchar();}
    return x*f;
}

vector< pii > t[N << 2];
int n, op[N], a[N], b[N], c[N];

void insert(int rt, int ll, int rr, int l, int r, pii x)
{

    if(ll == l && rr == r)
    {
        t[rt].PB(x);
        return ;
    }

    if(r <= md)
        insert(lson, l, r, x);
    else if(l > md)
        insert(rson, l, r, x);
    else
        insert(lson, l, md, x), insert(rson, md + 1, r, x);

}

LL ans;
bool vis[N << 2];

LL cross(pii &a, pii &b, pii &c)
{
    return 1LL * (b.fi - a.fi) * (c.se - a.se) - 1LL * (c.fi - a.fi) * (b.se - a.se);
}

LL f(pii &a, int p)
{
    return 1LL * p * a.fi + a.se;
}

void query(int rt, vector< pii > &t, int p)
{
    if(SZ(t) == 0) return;

    if(!vis[rt])
    {
        vis[rt] = true;
        sort(t.begin(), t.end());
        vector< pii > tmp;
        for(int i = 0; i < SZ(t); i++)
        {
            int now;
            while((now = SZ(tmp)) >= 2 && cross(tmp[now - 2], tmp[now - 1], t[i]) >= 0) tmp.pop_back();
            tmp.PB(t[i]);
        }
        t = tmp;
    }

    int l = 0, r = SZ(t) - 1, res = SZ(t) - 1;

    while(l <= r)
    {
        int mid = (l + r) >> 1;
        if(mid == SZ(t) - 1) break;
        if(f(t[mid], p) >= f(t[mid + 1], p)) res = mid, r = mid - 1;
        else l = mid + 1;
    }

    chkmax(ans, f(t[res], p));

}

void query(int rt, int ll, int rr, int x, int p)
{
    query(rt, t[rt], p);
    if(ll == rr) return;
    if(x <= md) query(lson, x, p);
    if(x > md) query(rson , x, p);
}

int main()
{
    n = read();

    for(int i = 1; i <= n; i++)
    {
        op[i] = read();
        if(op[i] == 1)
        {
            a[i] = read(), b[i] = read();
            c[i] = n;
        }
        else if(op[i] == 2)
        {
            a[i] = read();
            c[a[i]] = i;
        }
        else
        {
            a[i] = read();
        }
    }

    for(int i = 1; i <= n; i++)
        if(op[i] == 1) insert(1, 1, n, i, c[i], MP(a[i], b[i]));

    for(int i = 1; i <= n; i++)
        if(op[i] == 3)
        {
            ans = -INF;
            query(1, 1, n, i, a[i]);
            if(ans == -INF) puts("EMPTY SET");
            else printf("%lld\n",ans);
        }

    return 0;
}


#include <vector>
#include <list>
#include <map>
#include <set>
#include <deque>
#include <queue>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <string>
#include <cstring>
#include <ctime>

#include <fstream>

using namespace std;

#define LL long long
#define N 500005
#define M 4000100
#define MP make_pair
#define Pi acos(-1.0)
//#pradisma comment(linker,"/STACK:1024000000,1024000000")
#define ls (rt << 1)
#define rs (ls | 1)
#define md ((ll+rr)/2)
#define lson ls, ll, md
#define rson rs, md+1, rr
#define mod 1000000007
#define inf 0x3f3f3f3f
const LL INF = 1LL<<62
#define sqr(x) ((x)*(x))
#define eps 1e-9
#define uLL unsidisned londis londis
#define ui unsidisned int
LL powmod(LL a,LL b) {LL res=1;a%=mod;for(;b;b>>=1){if(b&1)res=res*a%mod;a=a*a%mod;}return res;}
#define F(x) ((x)/3+((x)%3 == 1 ? 0 : tb))
#define dis(x) ((x)<tb ? (x)*3+1 : ((x) - tb)*3+2)
#define lowbit(x) ((x)&(-x))
#define fi first
#define se second
#define pii pair<int,int>
#define pli pair<LL,int>
#define pll pair<LL,LL>
#define PB push_back
#define mp make_pair
#define SZ(x) x.size()

template<typename T> inline bool chkmin(T &a, const T &b) { return a > b ? a = b, 1 : 0; }
template<typename T> inline bool chkmax(T &a, const T &b) { return a < b ? a = b, 1 : 0; }

int read()
{
    int x=0,f=1;char ch=getchar();
    while(ch<'0'||ch>'9'){if(ch=='-')f=-1;ch=getchar();}
    while(ch>='0'&&ch<='9'){x=x*10+ch-'0';ch=getchar();}
    return x*f;
}

vector< pii > t[N << 2];
int n, op[N], a[N], b[N], c[N];

void insert(int rt, int ll, int rr, int l, int r, pii x)
{

    if(ll == l && rr == r)
    {
        t[rt].PB(x);
        return ;
    }

    if(r <= md)
        insert(lson, l, r, x);
    else if(l > md)
        insert(rson, l, r, x);
    else
        insert(lson, l, md, x), insert(rson, md + 1, r, x);

}

LL ans;
bool vis[N << 2];

LL cross(pii &a, pii &b, pii &c)
{
    return 1LL * (b.fi - a.fi) * (c.se - a.se) - 1LL * (c.fi - a.fi) * (b.se - a.se);
}

LL f(pii &a, int p)
{
    return 1LL * p * a.fi + a.se;
}

void query(int rt, vector< pii > &t, int p)
{
    if(SZ(t) == 0) return;

    if(!vis[rt])
    {
        vis[rt] = true;
        sort(t.begin(), t.end());
        vector< pii > tmp;
        for(int i = 0; i < SZ(t); i++)
        {
            int now;
            while((now = SZ(tmp)) >= 2 && cross(tmp[now - 2], tmp[now - 1], t[i]) >= 0) tmp.pop_back();
            tmp.PB(t[i]);
        }
        t = tmp;
    }

    int l = 0, r = SZ(t) - 1, res = SZ(t) - 1;

    while(l <= r)
    {
        int mid = (l + r) >> 1;
        if(mid == SZ(t) - 1) break;
        if(f(t[mid], p) >= f(t[mid + 1], p)) res = mid, r = mid - 1;
        else l = mid + 1;
    }

    chkmax(ans, f(t[res], p));

}

void query(int rt, int ll, int rr, int x, int p)
{
    query(rt, t[rt], p);
    if(ll == rr) return;
    if(x <= md) query(lson, x, p);
    if(x > md) query(rson , x, p);
}

int main()
{
    n = read();

    for(int i = 1; i <= n; i++)
    {
        op[i] = read();
        if(op[i] == 1)
        {
            a[i] = read(), b[i] = read();
            c[i] = n;
        }
        else if(op[i] == 2)
        {
            a[i] = read();
            c[a[i]] = i;
        }
        else
        {
            a[i] = read();
        }
    }

    for(int i = 1; i <= n; i++)
        if(op[i] == 1) insert(1, 1, n, i, c[i], MP(a[i], b[i]));

    for(int i = 1; i <= n; i++)
        if(op[i] == 3)
        {
            ans = -INF;
            query(1, 1, n, i, a[i]);
            if(ans == -INF) puts("EMPTY SET");
            else printf("%lld\n",ans);
        }

    return 0;
}


#include <vector>
#include <list>
#include <map>
#include <set>
#include <deque>
#include <queue>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <string>
#include <cstring>
#include <ctime>

#include <fstream>

using namespace std;

#define LL long long
#define N 500005
#define M 4000100
#define MP make_pair
#define Pi acos(-1.0)
//#pradisma comment(linker,"/STACK:1024000000,1024000000")
#define ls (rt << 1)
#define rs (ls | 1)
#define md ((ll+rr)/2)
#define lson ls, ll, md
#define rson rs, md+1, rr
#define mod 1000000007
#define inf 0x3f3f3f3f
const LL INF = 1e18 + 10;
#define sqr(x) ((x)*(x))
#define eps 1e-9
#define uLL unsidisned londis londis
#define ui unsidisned int
LL powmod(LL a,LL b) {LL res=1;a%=mod;for(;b;b>>=1){if(b&1)res=res*a%mod;a=a*a%mod;}return res;}
#define F(x) ((x)/3+((x)%3 == 1 ? 0 : tb))
#define dis(x) ((x)<tb ? (x)*3+1 : ((x) - tb)*3+2)
#define lowbit(x) ((x)&(-x))
#define fi first
#define se second
#define pii pair<int,int>
#define pli pair<LL,int>
#define pll pair<LL,LL>
#define PB push_back
#define mp make_pair
#define SZ(x) x.size()

template<typename T> inline bool chkmin(T &a, const T &b) { return a > b ? a = b, 1 : 0; }
template<typename T> inline bool chkmax(T &a, const T &b) { return a < b ? a = b, 1 : 0; }

int read()
{
    int x=0,f=1;char ch=getchar();
    while(ch<'0'||ch>'9'){if(ch=='-')f=-1;ch=getchar();}
    while(ch>='0'&&ch<='9'){x=x*10+ch-'0';ch=getchar();}
    return x*f;
}

vector< pii > t[N << 2];
int n, op[N], a[N], b[N], c[N];

void insert(int rt, int ll, int rr, int l, int r, pii x)
{

    if(ll == l && rr == r)
    {
        t[rt].PB(x);
        return ;
    }

    if(r <= md)
        insert(lson, l, r, x);
    else if(l > md)
        insert(rson, l, r, x);
    else
        insert(lson, l, md, x), insert(rson, md + 1, r, x);

}

LL ans;
bool vis[N << 2];

LL cross(pii &a, pii &b, pii &c)
{
    return 1LL * (b.fi - a.fi) * (c.se - a.se) - 1LL * (c.fi - a.fi) * (b.se - a.se);
}

LL f(pii &a, int p)
{
    return 1LL * p * a.fi + a.se;
}

void query(int rt, vector< pii > &t, int p)
{
    if(SZ(t) == 0) return;

    if(!vis[rt])
    {
        vis[rt] = true;
        sort(t.begin(), t.end());
        vector< pii > tmp;
        for(int i = 0; i < SZ(t); i++)
        {
            int now;
            while((now = SZ(tmp)) >= 2 && cross(tmp[now - 2], tmp[now - 1], t[i])) tmp.pop_back();
            tmp.PB(t[i]);
        }
        t = tmp;
    }

    int l = 0, r = SZ(t) - 1, res = SZ(t) - 1;

    while(l <= r)
    {
        int mid = (l + r) >> 1;
        if(mid == SZ(t) - 1) break;
        if(f(t[mid], p) >= f(t[mid + 1], p)) res = mid, r = mid - 1;
        else l = mid + 1;
    }

    chkmax(ans, f(t[res], p));

}

void query(int rt, int ll, int rr, int x, int p)
{
    query(rt, t[rt], p);
    if(ll == rr) return;
    if(x <= md) query(lson, x, p);
    if(x > md) query(rson , x, p);
}

int main()
{
    n = read();

    for(int i = 1; i <= n; i++)
    {
        op[i] = read();
        if(op[i] == 1)
        {
            a[i] = read(), b[i] = read();
            c[i] = n;
        }
        else if(op[i] == 2)
        {
            a[i] = read();
            c[a[i]] = i;
        }
        else
        {
            a[i] = read();
        }
    }

    for(int i = 1; i <= n; i++)
        if(op[i] == 1) insert(1, 1, n, i, c[i], MP(a[i], b[i]));

    for(int i = 1; i <= n; i++)
        if(op[i] == 3)
        {
            ans = -INF;
            query(1, 1, n, i, a[i]);
            if(ans == -INF) puts("EMPTY SET");
            else printf("%lld\n",ans);
        }

    return 0;
}


#include <cstdio>
#include <algorithm>
#include <vector>
using namespace std;
typedef long long ll;
int read() {
	char ch = getchar(); int x = 0, t = 1;
	while(ch < '0' || ch > '9') { if(ch == '-') t = -1; ch = getchar(); }
	while(ch >= '0' && ch <= '9') x = x*10+ch-'0', ch = getchar();
	return x*t;
}

const int maxn = 3e5+5;
const ll inf = 1e18;
struct Point {
	ll x, y;
	void init() { x = read(), y = read(); }
	ll calc(ll q) { return q*x+y; }
	bool operator <(const Point &b) const {
		return x != b.x ? x < b.x : y < b.y;
	}
	Point operator -(const Point &b) const {
		return (Point){ x-b.x, y-b.y };
	}
	ll operator *(const Point &b) const {
		return x*b.y - y*b.x;
	}
} p[maxn], st[maxn];

int N, tot, top;
int op[maxn], q[maxn], id[maxn], s[maxn], e[maxn];
ll ans[maxn];

struct Segment {
	#define mid (l+r>>1)
	#define lc o<<1, l, mid
	#define rc o<<1|1, mid+1, r
	vector <int> t[maxn<<2];

	void insert(int o, int l, int r, int x) {
		if(s[x] <= l && r <= e[x]) {
			t[o].push_back(x);
			return;
		}
		if(r < s[x] || e[x] < l) return;
		insert(lc, x), insert(rc, x);
	}

	ll query(ll x) {
		int l = 1, r = top;
		if(!top) return -inf;
		while(l < r-6) {
			int m1 = (2*l+r)/3, m2 = (l+2*r)/3;
			if(st[m1].calc(x) < st[m2].calc(x)) l = m1+1;
			else r = m2-1;
		}
		ll ret = st[l].calc(x);
		for(int i = l+1; i <= r; ++i)
			ret = max(ret, st[i].calc(x));
		return ret;
	}

	void solve(int o, int l, int r) {
		top = 0;
		sort(t[o].begin(), t[o].end());
		for(int i = 0; i < t[o].size(); ++i) {
			while(top > 1 && (p[t[o][i]]-st[top])*(st[top]-st[top-1]) <= 0)
				--top;
			st[++top] = p[t[o][i]];
		}
		for(int i = l; i <= r; ++i)
			if(op[i] == 3) ans[i] = max(ans[i], query(q[i]));

		if(l == r) return;
		solve(lc), solve(rc);
	}
} T;

int main() {
	N = read();
	for(int i = 1; i <= N; ++i) {
		op[i] = read(), ans[i] = -inf;
		if(op[i] == 1) {
			p[++tot].init();
			s[tot] = i, e[tot] = N;
			id[i] = tot;
		}
		if(op[i] == 2) e[id[read()]] = i-1;
		if(op[i] == 3) q[i] = read();
	}

	for(int i = 1; i <= tot; ++i) T.insert(1, 1, N, i);
	T.solve(1, 1, N);

	for(int i = 1; i <= N; ++i)
	if(op[i] == 3)
		if(ans[i] == -inf) printf("EMPTY SET\n");
		else printf("%lld\n", ans[i]);
	return 0;
}


#include <cstdio>
#include <algorithm>
#include <vector>
using namespace std;
typedef long long ll;
int read() {
	char ch = getchar(); int x = 0, t = 1;
	while(ch < '0' || ch > '9') { if(ch == '-') t = -1; ch = getchar(); }
	while(ch >= '0' && ch <= '9') x = x*10+ch-'0', ch = getchar();
	return x*t;
}

const int maxn = 3e5+5;
const ll inf = 1e18;
struct Point {
	ll x, y;
	void init() { x = read(), y = read(); }
	ll calc(ll q) { return q*x+y; }
	bool operator <(const Point &b) const {
		return x != b.x ? x < b.x : y < b.y;
	}
	Point operator -(const Point &b) const {
		return (Point){ x-b.x, y-b.y };
	}
	ll operator *(const Point &b) const {
		return x*b.y - y*b.x;
	}
} p[maxn], st[maxn];

int N, tot, top;
int op[maxn], q[maxn], id[maxn], s[maxn], e[maxn];
ll ans[maxn];

struct Segment {
	#define mid (l+r>>1)
	#define lc o<<1, l, mid
	#define rc o<<1|1, mid+1, r
	vector <int> t[maxn<<2];

	void insert(int o, int l, int r, int x) {
		if(s[x] <= l && r <= e[x]) {
			t[o].push_back(x);
			return;
		}
		if(r < s[x] || e[x] < l) return;
		insert(lc, x), insert(rc, x);
	}

	ll query(ll x) {
		int l = 1, r = top;
		if(!top) return -inf;
		while(l < r-3) {
			int m1 = (2*l+r)/3, m2 = (l+2*r)/3;
			if(st[m1].calc(x) < st[m2].calc(x)) l = m1+1;
			else r = m2-1;
		}
		ll ret = st[l].calc(x);
		for(int i = l+1; i <= r; ++i)
			ret = max(ret, st[i].calc(x));
		return ret;
	}

	void solve(int o, int l, int r) {
		top = 0;
		sort(t[o].begin(), t[o].end());
		for(int i = 0; i < t[o].size(); ++i) {
			while(top > 1 && (p[t[o][i]]-st[top])*(st[top]-st[top-1]) <= 0)
				--top;
			st[++top] = p[t[o][i]];
		}
		for(int i = l; i <= r; ++i)
			if(op[i] == 3) ans[i] = max(ans[i], query(q[i]));

		if(l == r) return;
		solve(lc), solve(rc);
	}
} T;

int main() {
	N = read();
	for(int i = 1; i <= N; ++i) {
		op[i] = read(), ans[i] = -inf;
		if(op[i] == 1) {
			p[++tot].init();
			s[tot] = i, e[tot] = N;
			id[i] = tot;
		}
		if(op[i] == 2) e[id[read()]] = i-1;
		if(op[i] == 3) q[i] = read();
	}

	for(int i = 1; i <= tot; ++i) T.insert(1, 1, N, i);
	T.solve(1, 1, N);

	for(int i = 1; i <= N; ++i)
	if(op[i] == 3)
		if(ans[i] == -inf) printf("EMPTY SET\n");
		else printf("%lld\n", ans[i]);
	return 0;
}


#include <cstdio>
#include <algorithm>
#include <vector>
using namespace std;
typedef long long ll;
int read() {
	char ch = getchar(); int x = 0, t = 1;
	while(ch < '0' || ch > '9') { if(ch == '-') t = -1; ch = getchar(); }
	while(ch >= '0' && ch <= '9') x = x*10+ch-'0', ch = getchar();
	return x*t;
}

const int maxn = 3e5+5;
const ll inf = ((ll)1e18)+5;
struct Point {
	ll x, y;
	void init() { x = read(), y = read(); }
	ll calc(ll q) { return q*x+y; }
	bool operator <(const Point &b) const {
		return x != b.x ? x < b.x : y < b.y;
	}
	Point operator -(const Point &b) const {
		return (Point){ x-b.x, y-b.y };
	}
	ll operator *(const Point &b) const {
		return x*b.y - y*b.x;
	}
} p[maxn], st[maxn];

int N, tot, top;
int op[maxn], q[maxn], id[maxn], s[maxn], e[maxn];
ll ans[maxn];

struct Segment {
	#define mid ((l+r)>>1)
	#define lc o<<1, l, mid
	#define rc o<<1|1, mid+1, r
	vector <Point> t[maxn<<2];

	void insert(int o, int l, int r, int x) {
		if(r < s[x] || e[x] < l) return;
		if(s[x] <= l && r <= e[x]) {
			t[o].push_back(p[x]);
			return;
		}
		insert(lc, x), insert(rc, x);
	}

	ll query(ll x) {
		int l = 1, r = top;
		if(!top) return -inf;
		while(r-l > 6) {
			int m1 = (2*l+r)/3, m2 = (l+2*r)/3;
			if(st[m1].calc(x) < st[m2].calc(x)) l = m1+1;
			else r = m2-1;
		}
		ll ret = -inf;
		for(int i = l; i <= r; ++i)
			ret = max(ret, st[i].calc(x));
		return ret;
	}

	void solve(int o, int l, int r) {
		top = 0;
		sort(t[o].begin(), t[o].end());
		for(int i = 0; i < t[o].size(); ++i) {
			Point x = t[o][i];
			while(top > 1 && (x-st[top])*(st[top]-st[top-1]) <= 0) --top;
			st[++top] = x;
		}
		for(int i = l; i <= r; ++i)
			if(op[i] == 3) ans[i] = max(ans[i], query(q[i]));

		if(l == r) return;
		solve(lc), solve(rc);
	}
} T;

int main() {
	N = read();
	for(int i = 1; i <= N; ++i) {
		op[i] = read(), ans[i] = -inf;
		if(op[i] == 1) {
			p[++tot].init();
			s[tot] = i, e[tot] = N;
			id[i] = tot;
		}
		if(op[i] == 2) e[id[read()]] = i-1;
		if(op[i] == 3) q[i] = read();
	}

	for(int i = 1; i <= tot; ++i) T.insert(1, 1, N, i);
	T.solve(1, 1, N);

	for(int i = 1; i <= N; ++i)
	if(op[i] == 3)
		if(ans[i] == -inf) printf("EMPTY SET\n");
		else printf("%lld\n", ans[i]);
	return 0;
}