#include <iostream>
#include <algorithm>
#include <vector>
#include <iterator>
#include <map>
using namespace std;
struct pll
{
	long long x, y;
};
bool operator <(const pll &a, const pll &b)
{
	return a.x < b.x || a.x == b.x&&a.y < b.y;
}
int main()
{
	ios::sync_with_stdio(false);
	int n;
	cin >> n;
	vector<pll> v;
	map<pll, vector<int>> m;
	for (int i = 0; i < n; i++)
	{
		int x, y;
		cin >> x >> y;
		auto p = pll{ x,y };
		if (m[p].size() == 0) v.push_back(p);
		m[p].push_back(i + 1);
	}
	swap(v[0], *min_element(v.begin(), v.end(), [](const pll &a, const pll &b)
	{
		return a.y > b.y || a.y == b.y&&a.x > b.x;
	}));
	sort(v.begin() + 1, v.end(), [&v](const pll &a, const pll &b)
	{
		long long t = (v[0].x - a.x)*(v[0].y - b.y)*a.y*b.x - (v[0].y - a.y)*(v[0].x - b.x)*a.x*b.y;
		return t == 0
			? pow(1.0 / a.x - 1.0 / v[0].x, 2) + pow(1.0 / a.y - 1.0 / v[0].y, 2)
				> pow(1.0 / b.x - 1.0 / v[0].x, 2) + pow(1.0 / b.y - 1.0 / v[0].y, 2)
			: t > 0;
	});
	vector<pll> p;
	auto l = min_element(v.begin(), v.end(), [](const pll &a, const pll &b)
	{
		return a.x > b.x || a.x == b.x&&a.y > b.y;
	});
	p.push_back(v[0]);
	if (l != v.begin()) copy(l, v.end(), back_insert_iterator<vector<pll>>(p));
	vector<pll> hull;
	if (p.size() <= 3) hull = p;
	else
	{
		hull.push_back(p[0]);
		hull.push_back(p[1]);
		for (int i = 2; i < p.size(); i++)
		{
			while (hull.size() > 2)
			{
				pll &a = hull[hull.size() - 1], &b = hull[hull.size() - 2];
				if ((b.x - a.x)*(b.y - p[i].y)*a.y*p[i].x < (b.y - a.y)*(b.x - p[i].x)*a.x*p[i].y)
					hull.pop_back();
				else break;
			}
			hull.push_back(p[i]);
		}
	}
	vector<int> res;
	for (auto it = hull.begin(); it != hull.end(); it++)
		copy(m[*it].begin(), m[*it].end(), back_insert_iterator<vector<int>>(res));
	sort(res.begin(), res.end());
	copy(res.begin(), res.end(), ostream_iterator<int>(cout, " "));
}


#include <iostream>
#include <algorithm>
#include <vector>
#include <iterator>
#include <map>
using namespace std;
struct pll
{
	long long x, y;
};
bool operator <(const pll &a, const pll &b)
{
	return a.x < b.x || a.x == b.x&&a.y < b.y;
}
int main()
{
	ios::sync_with_stdio(false);
	int n;
	cin >> n;
	vector<pll> v;
	map<pll, vector<int>> m;
	for (int i = 0; i < n; i++)
	{
		int x, y;
		cin >> x >> y;
		auto p = pll{ x,y };
		if (m[p].size() == 0) v.push_back(p);
		m[p].push_back(i + 1);
	}
	swap(v[0], *min_element(v.begin(), v.end(), [](const pll &a, const pll &b)
	{
		return a.y > b.y || a.y == b.y&&a.x > b.x;
	}));
	sort(v.begin() + 1, v.end(), [&v](const pll &a, const pll &b)
	{
		long long t = (v[0].x - a.x)*(v[0].y - b.y)*a.y*b.x - (v[0].y - a.y)*(v[0].x - b.x)*a.x*b.y;
		return t > 0;
	});
	vector<pll> hull;
	if (v.size() <= 3) hull = v;
	else
	{
		hull.push_back(v[0]);
		hull.push_back(v[1]);
		for (int i = 2; i < v.size(); i++)
		{
			while (hull.size() > 2)
			{
				pll &a = hull[hull.size() - 1], &b = hull[hull.size() - 2];
				if ((b.x - a.x)*(b.y - v[i].y)*a.y*v[i].x < (b.y - a.y)*(b.x - v[i].x)*a.x*v[i].y)
					hull.pop_back();
				else break;
			}
			hull.push_back(v[i]);
		}
	}
	vector<int> res;
	auto l = min_element(hull.begin(), hull.end(), [](const pll &a, const pll &b)
	{
		return a.x > b.x || a.x == b.x&&a.y > b.y;
	});
	res.insert(res.end(), m[hull[0]].begin(), m[hull[0]].end());
	if (l != hull.begin()) for (auto it = l; it != hull.end(); it++) res.insert(res.end(), m[*it].begin(), m[*it].end());
	sort(res.begin(), res.end());
	copy(res.begin(), res.end(), ostream_iterator<int>(cout, " "));
}


#include <iostream>
#include <algorithm>
#include <vector>
#include <iterator>
const long double eps = 1e-22;
using namespace std;
struct pdd { long double x, y; int id; };
long double cross(const pdd &a, const pdd &b)
{
	return a.x*b.y - a.y*b.x;
}
long double dot(const pdd &a, const pdd &b)
{
	return a.x*b.x + a.y*b.y;
}
pdd sub(const pdd &a, const pdd &b)
{
	return{ a.x - b.x,a.y - b.y,0 };
}
pdd operator -(const pdd &a, const pdd &b)
{
	return sub(a, b);
}
int main()
{
	ios::sync_with_stdio(false);
	int n;
	cin >> n;
	vector<pdd> v;
	for (int i = 0; i < n; i++)
	{
		int x, y;
		cin >> x >> y;
		v.push_back({ 1.0 / x,1.0 / y,i + 1 });
	}
	vector<pdd> hull;
	if (n <= 3) hull = v;
	else
	{
		swap(v[0], *max_element(v.begin(), v.end(), [](const pdd &a, const pdd &b)
		{
			return a.y < b.y || a.y == b.y&&a.x < b.x;
		}));
		sort(v.begin() + 1, v.end(), [&v](const pdd &a, const pdd &b)
		{
			long double t = cross(a - v[0], b - v[0]);
			return t == 0 ? dot(a - v[0], a - v[0]) < dot(b - v[0], b - v[0]) : t > 0;
		});
		hull.push_back(v[0]);
		hull.push_back(v[1]);
		for (int i = 2; i < n; i++)
		{
			while (hull.size() > 2 && cross(hull[hull.size() - 1] - hull[hull.size() - 2], v[i] - hull[hull.size() - 2]) < -eps) hull.pop_back();
			hull.push_back(v[i]);
		}
	}
	pdd &left = *min_element(hull.begin(), hull.end(), [](const pdd &a, const pdd &b)
	{
		return a.x < b.x || a.x == b.x&&a.y < b.y;
	});
	pdd &bottom = *min_element(hull.begin(), hull.end(), [](const pdd &a, const pdd &b)
	{
		return a.y < b.y || a.y == b.y&&a.x < b.x;
	});
	vector<pdd> res;
	copy_if(hull.begin(), hull.end(), back_insert_iterator<vector<pdd>>(res), [&left, &bottom](const pdd &a)
	{
		return dot(left - bottom, a - bottom) > -eps && cross(left - bottom, a - bottom) > -eps;
	});
	sort(res.begin(), res.end(), [](const pdd &a, const pdd &b)
	{
		return a.id < b.id;
	});
	for (pdd &a : res) cout << a.id << ' ';
}


#include <iostream>
#include <algorithm>
#include <vector>
#include <iterator>
using namespace std;
struct pdd { double x, y; int id; };
double cross(const pdd &a, const pdd &b)
{
	return a.x*b.y - a.y*b.x;
}
double dot(const pdd &a, const pdd &b)
{
	return a.x*b.x + a.y*b.y;
}
pdd operator -(const pdd &a, const pdd &b)
{
	return{ a.x - b.x,a.y - b.y };
}
int main()
{
	ios::sync_with_stdio(false);
	int n;
	cin >> n;
	vector<pdd> v;
	for (int i = 0; i < n; i++)
	{
		int x, y;
		cin >> x >> y;
		v.push_back({ 1.0 / x,1.0 / y,i + 1 });
	}
	vector<pdd> hull;
	if (n <= 3) hull = v;
	else
	{
		swap(v[0], *max_element(v.begin(), v.end(), [](const pdd &a, const pdd &b)
		{
			return a.y < b.y || a.y == b.y&&a.x < b.x;
		}));
		sort(v.begin() + 1, v.end(), [&v](const pdd &a, const pdd &b)
		{
			double t = cross(a - v[0], b - v[0]);
			return t == 0 ? dot(a - v[0], a - v[0]) < dot(b - v[0], b - v[0]) : t > 0;
		});
		hull.push_back(v[0]);
		hull.push_back(v[1]);
		for (int i = 2; i < n; i++)
		{
			while (hull.size() > 2 && cross(hull[n - 1] - hull[n - 2], v[i] - hull[n - 2]) < 0) hull.pop_back();
			hull.push_back(v[i]);
		}
	}
	pdd &left = *min_element(hull.begin(), hull.end(), [](const pdd &a, const pdd &b)
	{
		return a.x < b.x || a.x == b.x&&a.y < b.y;
	});
	pdd &bottom = *min_element(hull.begin(), hull.end(), [](const pdd &a, const pdd &b)
	{
		return a.y < b.y || a.y == b.y&&a.x < b.x;
	});
	vector<pdd> res;
	copy_if(hull.begin(), hull.end(), back_insert_iterator<vector<pdd>>(res), [&left, &bottom](const pdd &a)
	{
		return dot(left - bottom, a - bottom) >= 0 && cross(left - bottom, a - bottom) >= 0;
	});
	sort(res.begin(), res.end(), [](const pdd &a, const pdd &b)
	{
		return a.id < b.id;
	});
	for (pdd &a : res) cout << a.id << ' ';
}


#include <iostream>
#include <algorithm>
#include <vector>
#include <iterator>
using namespace std;
const long double eps = 1e-22;
struct pdd { long double x, y; int id; };
long double cross(const pdd &a, const pdd &b)
{
	return a.x*b.y - a.y*b.x;
}
long double dot(const pdd &a, const pdd &b)
{
	return a.x*b.x + a.y*b.y;
}
pdd operator -(const pdd &a, const pdd &b)
{
	return{ a.x - b.x,a.y - b.y,0 };
}
int main()
{
	ios::sync_with_stdio(false);
	int n;
	cin >> n;
	vector<pdd> v;
	for (int i = 0; i < n; i++)
	{
		int x, y;
		cin >> x >> y;
		v.push_back({ 1.0 / x,1.0 / y,i + 1 });
	}
	vector<pdd> hull;
	if (n <= 3) hull = v;
	else
	{
		swap(v[0], *min_element(v.begin(), v.end(), [](const pdd &a, const pdd &b)
		{
			return a.y < b.y || a.y == b.y&&a.x < b.x;
		}));
		sort(v.begin() + 1, v.end(), [&v](const pdd &a, const pdd &b)
		{
			long double t = cross(a - v[0], b - v[0]);
			return t > -eps&&t < eps ? dot(a - v[0], a - v[0]) < dot(b - v[0], b - v[0]) : t > eps;
		});
		hull.push_back(v[0]);
		hull.push_back(v[1]);
		for (int i = 2; i < n; i++)
		{
			while (hull.size() > 2 && cross(hull[hull.size() - 1] - hull[hull.size() - 2], v[i] - hull[hull.size() - 2]) < -eps)
				hull.pop_back();
			hull.push_back(v[i]);
		}
	}
	pdd &left = *min_element(hull.begin(), hull.end(), [](const pdd &a, const pdd &b)
	{
		return a.x < b.x || a.x == b.x&&a.y < b.y;
	});
	pdd &bottom = *min_element(hull.begin(), hull.end(), [](const pdd &a, const pdd &b)
	{
		return a.y < b.y || a.y == b.y&&a.x < b.x;
	});
	vector<pdd> res;
	copy_if(hull.begin(), hull.end(), back_insert_iterator<vector<pdd>>(res), [&left, &bottom](const pdd &a)
	{
		return dot(left - bottom, a - bottom) > -eps && cross(left - bottom, a - bottom) > -eps;
	});
	sort(res.begin(), res.end(), [](const pdd &a, const pdd &b)
	{
		return a.id < b.id;
	});
	for (pdd &a : res) cout << a.id << ' ';
}


#include <iostream>
#include <algorithm>
#include <vector>
#include <iterator>
using namespace std;
const long double eps = 1e-12;
struct pdd { long double x, y; int id; };
long double cross(const pdd &a, const pdd &b)
{
	return a.x*b.y - a.y*b.x;
}
long double dot(const pdd &a, const pdd &b)
{
	return a.x*b.x + a.y*b.y;
}
pdd operator -(const pdd &a, const pdd &b)
{
	return{ a.x - b.x,a.y - b.y,0 };
}
int main()
{
	ios::sync_with_stdio(false);
	int n;
	cin >> n;
	vector<pdd> v;
	for (int i = 0; i < n; i++)
	{
		int x, y;
		cin >> x >> y;
		v.push_back({ 1.0 / x,1.0 / y,i + 1 });
	}
	vector<pdd> hull;
	if (n <= 3) hull = v;
	else
	{
		swap(v[0], *min_element(v.begin(), v.end(), [](const pdd &a, const pdd &b)
		{
			return a.y < b.y || a.y == b.y&&a.x < b.x;
		}));
		sort(v.begin() + 1, v.end(), [&v](const pdd &a, const pdd &b)
		{
			long double t = cross(a - v[0], b - v[0]);
			return t > -eps&&t < eps ? dot(a - v[0], a - v[0]) < dot(b - v[0], b - v[0]) : t > eps;
		});
		hull.push_back(v[0]);
		hull.push_back(v[1]);
		for (int i = 2; i < n; i++)
		{
			while (hull.size() > 2 && cross(hull[hull.size() - 1] - hull[hull.size() - 2], v[i] - hull[hull.size() - 2]) < -eps)
				hull.pop_back();
			hull.push_back(v[i]);
		}
	}
	pdd &left = *min_element(hull.begin(), hull.end(), [](const pdd &a, const pdd &b)
	{
		return a.x < b.x || a.x == b.x&&a.y < b.y;
	});
	pdd &bottom = *min_element(hull.begin(), hull.end(), [](const pdd &a, const pdd &b)
	{
		return a.y < b.y || a.y == b.y&&a.x < b.x;
	});
	vector<pdd> res;
	copy_if(hull.begin(), hull.end(), back_insert_iterator<vector<pdd>>(res), [&left, &bottom](const pdd &a)
	{
		return dot(left - bottom, a - bottom) > -eps && cross(left - bottom, a - bottom) > -eps;
	});
	sort(res.begin(), res.end(), [](const pdd &a, const pdd &b)
	{
		return a.id < b.id;
	});
	for (pdd &a : res) cout << a.id << ' ';
}


#include <iostream>
#include <algorithm>
#include <vector>
#include <iterator>
using namespace std;
struct pdd { double x, y; int id; };
double cross(const pdd &a, const pdd &b)
{
	return a.x*b.y - a.y*b.x;
}
double dot(const pdd &a, const pdd &b)
{
	return a.x*b.x + a.y*b.y;
}
pdd operator -(const pdd &a, const pdd &b)
{
	return{ a.x - b.x,a.y - b.y };
}
int main()
{
	ios::sync_with_stdio(false);
	int n;
	cin >> n;
	vector<pdd> v;
	for (int i = 0; i < n; i++)
	{
		int x, y;
		cin >> x >> y;
		v.push_back({ 1.0 / x,1.0 / y,i + 1 });
	}
	vector<pdd> hull;
	if (n <= 3) hull = v;
	else
	{
		swap(v[0], *max_element(v.begin(), v.end(), [](const pdd &a, const pdd &b)
		{
			return a.y < b.y || a.y == b.y&&a.x < b.x;
		}));
		sort(v.begin() + 1, v.end(), [&v](const pdd &a, const pdd &b)
		{
			double t = cross(a - v[0], b - v[0]);
			return t == 0 ? dot(a - v[0], a - v[0]) < dot(b - v[0], b - v[0]) : t > 0;
		});
		hull.push_back(v[0]);
		hull.push_back(v[1]);
		for (int i = 2; i < n; i++)
		{
			while (hull.size() > 2 && cross(hull[hull.size() - 1] - hull[hull.size() - 2], v[i] - hull[hull.size() - 2]) < 0) hull.pop_back();
			hull.push_back(v[i]);
		}
	}
	pdd &left = *min_element(hull.begin(), hull.end(), [](const pdd &a, const pdd &b)
	{
		return a.x < b.x || a.x == b.x&&a.y < b.y;
	});
	pdd &bottom = *min_element(hull.begin(), hull.end(), [](const pdd &a, const pdd &b)
	{
		return a.y < b.y || a.y == b.y&&a.x < b.x;
	});
	vector<pdd> res;
	copy_if(hull.begin(), hull.end(), back_insert_iterator<vector<pdd>>(res), [&left, &bottom](const pdd &a)
	{
		return dot(left - bottom, a - bottom) >= 0 && cross(left - bottom, a - bottom) >= 0;
	});
	sort(res.begin(), res.end(), [](const pdd &a, const pdd &b)
	{
		return a.id < b.id;
	});
	for (pdd &a : res) cout << a.id << ' ';
}


#include <iostream>
#include <algorithm>
#include <vector>
#include <iterator>
#include <cmath>
const double eps = 1e-12;
using namespace std;
struct pdd { double x, y; int id; };
double cross(const pdd &a, const pdd &b)
{
	return a.x*b.y - a.y*b.x;
}
double dot(const pdd &a, const pdd &b)
{
	return a.x*b.x + a.y*b.y;
}
pdd sub(const pdd &a, const pdd &b)
{
	return{ a.x - b.x,a.y - b.y,0 };
}
pdd operator -(const pdd &a, const pdd &b)
{
	return sub(a, b);
}
int main()
{
	ios::sync_with_stdio(false);
	int n;
	cin >> n;
	vector<pdd> v;
	for (int i = 0; i < n; i++)
	{
		int x, y;
		cin >> x >> y;
		v.push_back({ 1.0 / x,1.0 / y,i + 1 });
	}
	vector<pdd> hull;
	if (n <= 3) hull = v;
	else
	{
		swap(v[0], *max_element(v.begin(), v.end(), [](const pdd &a, const pdd &b)
		{
			return a.y < b.y || a.y == b.y&&a.x < b.x;
		}));
		sort(v.begin() + 1, v.end(), [&v](const pdd &a, const pdd &b)
		{
			double t = cross(a - v[0], b - v[0]);
			return t == 0 ? dot(a - v[0], a - v[0]) < dot(b - v[0], b - v[0]) : t > 0;
		});
		hull.push_back(v[0]);
		hull.push_back(v[1]);
		for (int i = 2; i < n; i++)
		{
			while (hull.size() > 2 && cross(hull[hull.size() - 1] - hull[hull.size() - 2], v[i] - hull[hull.size() - 2]) < -eps) hull.pop_back();
			hull.push_back(v[i]);
		}
	}
	pdd &left = *min_element(hull.begin(), hull.end(), [](const pdd &a, const pdd &b)
	{
		return a.x < b.x || a.x == b.x&&a.y < b.y;
	});
	pdd &bottom = *min_element(hull.begin(), hull.end(), [](const pdd &a, const pdd &b)
	{
		return a.y < b.y || a.y == b.y&&a.x < b.x;
	});
	vector<pdd> res;
	copy_if(hull.begin(), hull.end(), back_insert_iterator<vector<pdd>>(res), [&left, &bottom](const pdd &a)
	{
		return dot(left - bottom, a - bottom) > -eps && cross(left - bottom, a - bottom) > -eps;
	});
	sort(res.begin(), res.end(), [](const pdd &a, const pdd &b)
	{
		return a.id < b.id;
	});
	for (pdd &a : res) cout << a.id << ' ';
}


#include <iostream>
#include <algorithm>
#include <vector>
#include <iterator>
using namespace std;
const long double eps = 1e-22;
struct pdd { long double x, y; int id; };
long double cross(const pdd &a, const pdd &b)
{
	return a.x*b.y - a.y*b.x;
}
long double dot(const pdd &a, const pdd &b)
{
	return a.x*b.x + a.y*b.y;
}
pdd operator -(const pdd &a, const pdd &b)
{
	return{ a.x - b.x,a.y - b.y };
}
int main()
{
	ios::sync_with_stdio(false);
	int n;
	cin >> n;
	vector<pdd> v;
	for (int i = 0; i < n; i++)
	{
		int x, y;
		cin >> x >> y;
		v.push_back({ 1.0 / x,1.0 / y,i + 1 });
	}
	vector<pdd> hull;
	if (n <= 3) hull = v;
	else
	{
		swap(v[0], *max_element(v.begin(), v.end(), [](const pdd &a, const pdd &b)
		{
			return a.y < b.y || a.y == b.y&&a.x < b.x;
		}));
		sort(v.begin() + 1, v.end(), [&v](const pdd &a, const pdd &b)
		{
			long double t = cross(a - v[0], b - v[0]);
			return t < eps&&t > -eps ? dot(a - v[0], a - v[0]) < dot(b - v[0], b - v[0]) : t > eps;
		});
		hull.push_back(v[0]);
		hull.push_back(v[1]);
		for (int i = 2; i < n; i++)
		{
			while (hull.size() > 2 && cross(hull[hull.size() - 1] - hull[hull.size() - 2], v[i] - hull[hull.size() - 2]) < eps)
				hull.pop_back();
			hull.push_back(v[i]);
		}
	}
	pdd &left = *min_element(hull.begin(), hull.end(), [](const pdd &a, const pdd &b)
	{
		return a.x < b.x || a.x == b.x&&a.y < b.y;
	});
	pdd &bottom = *min_element(hull.begin(), hull.end(), [](const pdd &a, const pdd &b)
	{
		return a.y < b.y || a.y == b.y&&a.x < b.x;
	});
	vector<pdd> res;
	copy_if(hull.begin(), hull.end(), back_insert_iterator<vector<pdd>>(res), [&left, &bottom](const pdd &a)
	{
		return dot(left - bottom, a - bottom) > -eps && cross(left - bottom, a - bottom) > -eps;
	});
	sort(res.begin(), res.end(), [](const pdd &a, const pdd &b)
	{
		return a.id < b.id;
	});
	for (pdd &a : res) cout << a.id << ' ';
}


#include <iostream>
#include <algorithm>
#include <vector>
#include <iterator>
#include <map>
#include <functional>
using namespace std;
struct pll
{
	long long x, y;
};
bool operator <(const pll &a, const pll &b)
{
	return a.x < b.x || a.x == b.x&&a.y < b.y;
}
int main()
{
	ios::sync_with_stdio(false);
	int n;
	cin >> n;
	vector<pll> v;
	map<pll, vector<int>> m;
	for (int i = 0; i < n; i++)
	{
		int x, y;
		cin >> x >> y;
		auto p = pll{ x,y };
		if (m[p].size() == 0) v.push_back(p);
		m[p].push_back(i + 1);
	}
	swap(v[0], *min_element(v.begin(), v.end(), [](const pll &a, const pll &b)
	{
		return a.y > b.y || a.y == b.y&&a.x > b.x;
	}));
	sort(v.begin() + 1, v.end(), [&v](const pll &a, const pll &b)
	{
		return (v[0].x - a.x)*(v[0].y - b.y)*a.y*b.x > (v[0].y - a.y)*(v[0].x - b.x)*a.x*b.y;
	});
	vector<pll> hull;
	if (v.size() <= 3) hull = v;
	else
	{
		hull.push_back(v[0]);
		hull.push_back(v[1]);
		for (int i = 2; i < v.size(); i++)
		{
			while (hull.size() > 2)
			{
				pll &a = hull[hull.size() - 1], &b = hull[hull.size() - 2];
				if ((b.x - a.x)*(b.y - v[i].y)*a.y*v[i].x <= (b.y - a.y)*(b.x - v[i].x)*a.x*v[i].y)
					hull.pop_back();
				else break;
			}
			hull.push_back(v[i]);
		}
	}
	vector<int> res;
	auto l = min_element(hull.begin(), hull.end(), [](const pll &a, const pll &b)
	{
		return a.x > b.x || a.x == b.x&&a.y > b.y;
	});
	if (l != hull.begin()) res.insert(res.end(), m[hull[0]].begin(), m[hull[0]].end());
	for (auto it = l; it != hull.end(); it++) res.insert(res.end(), m[*it].begin(), m[*it].end());
	sort(res.begin(), res.end());
	copy(res.begin(), res.end(), ostream_iterator<int>(cout, " "));
}


#include <iostream>
#include <algorithm>
#include <vector>
#include <iterator>
const long double eps = 1e-22;
using namespace std;
struct pdd { long double x, y; int id; };
long double cross(const pdd &a, const pdd &b)
{
	return a.x*b.y - a.y*b.x;
}
long double dot(const pdd &a, const pdd &b)
{
	return a.x*b.x + a.y*b.y;
}
pdd sub(const pdd &a, const pdd &b)
{
	return{ a.x - b.x,a.y - b.y,0 };
}
pdd operator -(const pdd &a, const pdd &b)
{
	return sub(a, b);
}
int main()
{
	ios::sync_with_stdio(false);
	int n;
	cin >> n;
	vector<pdd> v;
	for (int i = 0; i < n; i++)
	{
		int x, y;
		cin >> x >> y;
		v.push_back({ 1.0 / x,1.0 / y,i + 1 });
	}
	vector<pdd> hull;
	if (n <= 3) hull = v;
	else
	{
		swap(v[0], *min_element(v.begin(), v.end(), [](const pdd &a, const pdd &b)
		{
			return a.y < b.y || a.y == b.y&&a.x < b.x;
		}));
		sort(v.begin() + 1, v.end(), [&v](const pdd &a, const pdd &b)
		{
			long double t = cross(a - v[0], b - v[0]);
			return t > -eps&&t < eps ? dot(a - v[0], a - v[0]) < dot(b - v[0], b - v[0]) : t > eps;
		});
		hull.push_back(v[0]);
		hull.push_back(v[1]);
		for (int i = 2; i < n; i++)
		{
			while (hull.size() > 2 && cross(hull[hull.size() - 1] - hull[hull.size() - 2], v[i] - hull[hull.size() - 2]) < -eps) hull.pop_back();
			hull.push_back(v[i]);
		}
	}
	pdd &left = *min_element(hull.begin(), hull.end(), [](const pdd &a, const pdd &b)
	{
		return a.x < b.x || a.x == b.x&&a.y < b.y;
	});
	pdd &bottom = *min_element(hull.begin(), hull.end(), [](const pdd &a, const pdd &b)
	{
		return a.y < b.y || a.y == b.y&&a.x < b.x;
	});
	vector<pdd> res;
	copy_if(hull.begin(), hull.end(), back_insert_iterator<vector<pdd>>(res), [&left, &bottom](const pdd &a)
	{
		return dot(left - bottom, a - bottom) > -eps && cross(left - bottom, a - bottom) > -eps;
	});
	sort(res.begin(), res.end(), [](const pdd &a, const pdd &b)
	{
		return a.id < b.id;
	});
	for (pdd &a : res) cout << a.id << ' ';
}


#include <iostream>
#include <algorithm>
#include <vector>
#include <iterator>
using namespace std;
const double eps = 1e-12;
struct pdd { long double x, y; int id; };
long double cross(const pdd &a, const pdd &b)
{
	return a.x*b.y - a.y*b.x;
}
long double dot(const pdd &a, const pdd &b)
{
	return a.x*b.x + a.y*b.y;
}
pdd operator -(const pdd &a, const pdd &b)
{
	return{ a.x - b.x,a.y - b.y };
}
int main()
{
	ios::sync_with_stdio(false);
	int n;
	cin >> n;
	vector<pdd> v;
	for (int i = 0; i < n; i++)
	{
		int x, y;
		cin >> x >> y;
		v.push_back({ 1.0 / x,1.0 / y,i + 1 });
	}
	vector<pdd> hull;
	if (n <= 3) hull = v;
	else
	{
		swap(v[0], *max_element(v.begin(), v.end(), [](const pdd &a, const pdd &b)
		{
			return a.y < b.y || a.y == b.y&&a.x < b.x;
		}));
		sort(v.begin() + 1, v.end(), [&v](const pdd &a, const pdd &b)
		{
			long double t = cross(a - v[0], b - v[0]);
			return t < eps&&t > -eps ? dot(a - v[0], a - v[0]) < dot(b - v[0], b - v[0]) : t > eps;
		});
		hull.push_back(v[0]);
		hull.push_back(v[1]);
		for (int i = 2; i < n; i++)
		{
			while (hull.size() > 2 && cross(hull[hull.size() - 1] - hull[hull.size() - 2], v[i] - hull[hull.size() - 2]) <= 0) hull.pop_back();
			hull.push_back(v[i]);
		}
	}
	pdd &left = *min_element(hull.begin(), hull.end(), [](const pdd &a, const pdd &b)
	{
		return a.x < b.x || a.x == b.x&&a.y < b.y;
	});
	pdd &bottom = *min_element(hull.begin(), hull.end(), [](const pdd &a, const pdd &b)
	{
		return a.y < b.y || a.y == b.y&&a.x < b.x;
	});
	vector<pdd> res;
	copy_if(hull.begin(), hull.end(), back_insert_iterator<vector<pdd>>(res), [&left, &bottom](const pdd &a)
	{
		return dot(left - bottom, a - bottom) > -eps && cross(left - bottom, a - bottom) > -eps;
	});
	sort(res.begin(), res.end(), [](const pdd &a, const pdd &b)
	{
		return a.id < b.id;
	});
	for (pdd &a : res) cout << a.id << ' ';
}


#include <iostream>
#include <algorithm>
#include <vector>
#include <iterator>
using namespace std;
struct pdd { long double x, y; int id; };
double cross(const pdd &a, const pdd &b)
{
	return a.x*b.y - a.y*b.x;
}
double dot(const pdd &a, const pdd &b)
{
	return a.x*b.x + a.y*b.y;
}
pdd operator -(const pdd &a, const pdd &b)
{
	return{ a.x - b.x,a.y - b.y };
}
int main()
{
	ios::sync_with_stdio(false);
	int n;
	cin >> n;
	vector<pdd> v;
	for (int i = 0; i < n; i++)
	{
		int x, y;
		cin >> x >> y;
		v.push_back({ 1.0 / x,1.0 / y,i + 1 });
	}
	vector<pdd> hull;
	if (n <= 3) hull = v;
	else
	{
		swap(v[0], *max_element(v.begin(), v.end(), [](const pdd &a, const pdd &b)
		{
			return a.y < b.y || a.y == b.y&&a.x < b.x;
		}));
		sort(v.begin() + 1, v.end(), [&v](const pdd &a, const pdd &b)
		{
			long double t = cross(a - v[0], b - v[0]);
			return t == 0 ? dot(a - v[0], a - v[0]) < dot(b - v[0], b - v[0]) : t > 0;
		});
		hull.push_back(v[0]);
		hull.push_back(v[1]);
		for (int i = 2; i < n; i++)
		{
			while (hull.size() > 2 && cross(hull[hull.size() - 1] - hull[hull.size() - 2], v[i] - hull[hull.size() - 2]) <= 0) hull.pop_back();
			hull.push_back(v[i]);
		}
	}
	pdd &left = *min_element(hull.begin(), hull.end(), [](const pdd &a, const pdd &b)
	{
		return a.x < b.x || a.x == b.x&&a.y < b.y;
	});
	pdd &bottom = *min_element(hull.begin(), hull.end(), [](const pdd &a, const pdd &b)
	{
		return a.y < b.y || a.y == b.y&&a.x < b.x;
	});
	vector<pdd> res;
	copy_if(hull.begin(), hull.end(), back_insert_iterator<vector<pdd>>(res), [&left, &bottom](const pdd &a)
	{
		return dot(left - bottom, a - bottom) >= 0 && cross(left - bottom, a - bottom) >= 0;
	});
	sort(res.begin(), res.end(), [](const pdd &a, const pdd &b)
	{
		return a.id < b.id;
	});
	for (pdd &a : res) cout << a.id << ' ';
}


#include <iostream>
#include <algorithm>
#include <vector>
#include <iterator>
#include <map>
using namespace std;
struct pll
{
	long long x, y;
};
bool operator <(const pll &a, const pll &b)
{
	return a.x < b.x || a.x == b.x&&a.y < b.y;
}
int main()
{
	ios::sync_with_stdio(false);
	int n;
	cin >> n;
	vector<pll> v;
	map<pll, vector<int>> m;
	for (int i = 0; i < n; i++)
	{
		int x, y;
		cin >> x >> y;
		auto p = pll{ x,y };
		if (m[p].size() == 0) v.push_back(p);
		m[p].push_back(i + 1);
	}
	swap(v[0], *min_element(v.begin(), v.end(), [](const pll &a, const pll &b)
	{
		return a.y > b.y || a.y == b.y&&a.x > b.x;
	}));
	sort(v.begin() + 1, v.end(), [&v](const pll &a, const pll &b)
	{
		long long t = (v[0].x - a.x)*(v[0].y - b.y)*a.y*b.x - (v[0].y - a.y)*(v[0].x - b.x)*a.x*b.y;
		return t == 0
			? pow(1.0 / a.x - 1.0 / v[0].x, 2) + pow(1.0 / a.y - 1.0 / v[0].y, 2)
				> pow(1.0 / b.x - 1.0 / v[0].x, 2) + pow(1.0 / b.y - 1.0 / v[0].y, 2)
			: t > 0;
	});
	vector<pll> p;
	auto l = min_element(v.begin(), v.end(), [](const pll &a, const pll &b)
	{
		return a.x > b.x || a.x == b.x&&a.y > b.y;
	});
	if (l != v.begin()) copy(l, v.end(), back_insert_iterator<vector<pll>>(p));
	p.push_back(v[0]);
	vector<pll> hull;
	if (p.size() <= 3) hull = p;
	else
	{
		hull.push_back(p[0]);
		hull.push_back(p[1]);
		for (int i = 2; i < p.size(); i++)
		{
			while (hull.size() > 2)
			{
				pll &a = hull[hull.size() - 1], &b = hull[hull.size() - 2];
				if ((b.x - a.x)*(b.y - p[i].y)*a.y*p[i].x < (b.y - a.y)*(b.x - p[i].x)*a.x*p[i].y)
					hull.pop_back();
				else break;
			}
			hull.push_back(p[i]);
		}
	}
	vector<int> res;
	for (auto it = hull.begin(); it != hull.end(); it++)
		copy(m[*it].begin(), m[*it].end(), back_insert_iterator<vector<int>>(res));
	sort(res.begin(), res.end());
	copy(res.begin(), res.end(), ostream_iterator<int>(cout, " "));
}


#include <iostream>
#include <algorithm>
#include <vector>
#include <iterator>
using namespace std;
struct pdd { long long x, y; int id; };
int main()
{
	ios::sync_with_stdio(false);
	int n;
	cin >> n;
	vector<pdd> v;
	for (int i = 0; i < n; i++)
	{
		int x, y;
		cin >> x >> y;
		v.push_back({ x,y,i + 1 });
	}
	swap(v[0], *min_element(v.begin(), v.end(), [](const pdd &a, const pdd &b)
	{
		return a.y > b.y || a.y == b.y&&a.x > b.x;
	}));
	sort(v.begin() + 1, v.end(), [&v](const pdd &a, const pdd &b)
	{
		return (v[0].x - a.x)*(v[0].y - b.y)*a.y*b.x > (v[0].y - a.y)*(v[0].x - b.x)*a.x*b.y;
	});
	vector<pdd> hull;
	if (n <= 3) hull = v;
	else
	{
		hull.push_back(v[0]);
		hull.push_back(v[1]);
		for (int i = 2; i < n; i++)
		{
			while (hull.size() > 2)
			{
				pdd &a = hull[hull.size() - 1], &b = hull[hull.size() - 2];
				if ((b.x - a.x)*(b.y - v[i].y)*a.y*v[i].x < (b.y - a.y)*(b.x - v[i].x)*a.x*v[i].y)
					hull.pop_back();
				else break;
			}
			hull.push_back(v[i]);
		}
	}
	vector<pdd> res;
	auto l = min_element(hull.begin(), hull.end(), [](const pdd &a, const pdd &b)
	{
		return a.x > b.x || a.x == b.x&&a.y > b.y;
	});
	if (l != hull.begin()) res.push_back(hull[0]);;
	copy(l, hull.end(), back_insert_iterator<vector<pdd>>(res));
	sort(res.begin(), res.end(), [](const pdd &a, const pdd &b)
	{
		return a.id < b.id;
	});
	for (pdd &a : res) cout << a.id << ' ';
}


#include <iostream>
#include <algorithm>
#include <vector>
#include <iterator>
using namespace std;
const long double eps = 1e-22;
struct pdd { long double x, y; int id; };
long double cross(const pdd &a, const pdd &b)
{
	return a.x*b.y - a.y*b.x;
}
long double dot(const pdd &a, const pdd &b)
{
	return a.x*b.x + a.y*b.y;
}
pdd operator -(const pdd &a, const pdd &b)
{
	return{ a.x - b.x,a.y - b.y };
}
int main()
{
	ios::sync_with_stdio(false);
	int n;
	cin >> n;
	vector<pdd> v;
	for (int i = 0; i < n; i++)
	{
		int x, y;
		cin >> x >> y;
		v.push_back({ 1.0 / x,1.0 / y,i + 1 });
	}
	vector<pdd> hull;
	if (n <= 3) hull = v;
	else
	{
		swap(v[0], *min_element(v.begin(), v.end(), [](const pdd &a, const pdd &b)
		{
			return a.y < b.y || a.y == b.y&&a.x < b.x;
		}));
		sort(v.begin() + 1, v.end(), [&v](const pdd &a, const pdd &b)
		{
			long double t = cross(a - v[0], b - v[0]);
			return t < eps&&t > -eps ? dot(a - v[0], a - v[0]) < dot(b - v[0], b - v[0]) : t > eps;
		});
		hull.push_back(v[0]);
		hull.push_back(v[1]);
		for (int i = 2; i < n; i++)
		{
			while (hull.size() > 2 && cross(hull[hull.size() - 1] - hull[hull.size() - 2], v[i] - hull[hull.size() - 2]) < eps)
				hull.pop_back();
			hull.push_back(v[i]);
		}
	}
	pdd &left = *min_element(hull.begin(), hull.end(), [](const pdd &a, const pdd &b)
	{
		return a.x < b.x || a.x == b.x&&a.y < b.y;
	});
	pdd &bottom = *min_element(hull.begin(), hull.end(), [](const pdd &a, const pdd &b)
	{
		return a.y < b.y || a.y == b.y&&a.x < b.x;
	});
	vector<pdd> res;
	copy_if(hull.begin(), hull.end(), back_insert_iterator<vector<pdd>>(res), [&left, &bottom](const pdd &a)
	{
		return dot(left - bottom, a - bottom) > -eps && cross(left - bottom, a - bottom) > -eps;
	});
	sort(res.begin(), res.end(), [](const pdd &a, const pdd &b)
	{
		return a.id < b.id;
	});
	for (pdd &a : res) cout << a.id << ' ';
}


#include <iostream>
#include <algorithm>
#include <vector>
#include <iterator>
using namespace std;
struct pdd { double x, y; int id; };
double cross(const pdd &a, const pdd &b)
{
	return a.x*b.y - a.y*b.x;
}
double dot(const pdd &a, const pdd &b)
{
	return a.x*b.x + a.y*b.y;
}
pdd operator -(const pdd &a, const pdd &b)
{
	return{ a.x - b.x,a.y - b.y };
}
int main()
{
	ios::sync_with_stdio(false);
	int n;
	cin >> n;
	vector<pdd> v;
	for (int i = 0; i < n; i++)
	{
		int x, y;
		cin >> x >> y;
		v.push_back({ 1.0 / x,1.0 / y,i + 1 });
	}
	vector<pdd> hull;
	if (n <= 3) hull = v;
	else
	{
		swap(v[0], *max_element(v.begin(), v.end(), [](const pdd &a, const pdd &b)
		{
			return a.y < b.y || a.y == b.y&&a.x < b.x;
		}));
		sort(v.begin() + 1, v.end(), [&v](const pdd &a, const pdd &b)
		{
			double t = cross(a - v[0], b - v[0]);
			return t == 0 ? dot(a - v[0], a - v[0]) < dot(b - v[0], b - v[0]) : t > 0;
		});
		hull.push_back(v[0]);
		hull.push_back(v[1]);
		for (int i = 2; i < n; i++)
		{
			while (hull.size() > 2 && cross(hull[hull.size() - 1] - hull[hull.size() - 2], v[i] - hull[hull.size() - 2]) <= 0) hull.pop_back();
			hull.push_back(v[i]);
		}
	}
	pdd &left = *min_element(hull.begin(), hull.end(), [](const pdd &a, const pdd &b)
	{
		return a.x < b.x || a.x == b.x&&a.y < b.y;
	});
	pdd &bottom = *min_element(hull.begin(), hull.end(), [](const pdd &a, const pdd &b)
	{
		return a.y < b.y || a.y == b.y&&a.x < b.x;
	});
	vector<pdd> res;
	copy_if(hull.begin(), hull.end(), back_insert_iterator<vector<pdd>>(res), [&left, &bottom](const pdd &a)
	{
		return dot(left - bottom, a - bottom) >= 0 && cross(left - bottom, a - bottom) >= 0;
	});
	sort(res.begin(), res.end(), [](const pdd &a, const pdd &b)
	{
		return a.id < b.id;
	});
	for (pdd &a : res) cout << a.id << ' ';
}


#include<iostream>
#include<cstdio>
#include<algorithm>
#include<cstring>
using namespace std;
int n;
struct Node{
	double a,b;
	int id;
}poi[200200];
bool cmp(Node a,Node b){return a.a<b.a||a.a==b.a&&a.b<b.b;}
int fa[200200];
int find(int x){return fa[x]==x?x:fa[x]=find(fa[x]);}
int sta[200200],top;
Node en[200200];
double sl(Node x,Node y) { return (x.b-y.b)/(x.a-y.a); }
bool book[200200];
int main()
{
	scanf("%d",&n);
	int a,b;
	for(int i=1;i<=n;++i)
	{
		scanf("%d%d",&a,&b);
		poi[i].a=100.00/a;poi[i].b=100.00/b;
		poi[i].id=i;
		fa[i]=i;
	}
	sort(poi+1,poi+n+1,cmp);
	int tn=n,n=0;
	for(int i=1;i<=tn;++i)
	{
		if(poi[i].a==poi[n].a&&poi[i].b==poi[n].b)
		{
			fa[find(poi[i].id)]=find(poi[n].id);
			continue;
		}
		if(poi[i].a==poi[n].a)continue;
		poi[++n]=poi[i];
	}
	for(int i=1;i<=n;++i)
	{
		if(!top){sta[++top]=i;continue;}
		while(top>1&&sl(poi[i],poi[sta[top-1]])<
				sl(poi[sta[top]],poi[sta[top-1]]))top--;
		sta[++top]=i;
	}
	for(int i=1;i<=top;++i) en[i]=poi[sta[i]];
	book[find(en[1].id)]=1;
	for(int i=1;i<top;++i)
		if(sl(en[i],en[i+1])<0)
			book[find(en[i].id)]=book[find(en[i+1].id)]=1;
	for(int i=1;i<=tn;++i)
		if(book[find(i)])printf("%d ",i);
	puts("");
	return 0;
}


#include<iostream>
#include<cstdio>
#include<algorithm>
#include<cstring>
using namespace std;
int n;
struct Node{
	double a,b;
	int id;
}poi[200200];
bool cmp(Node a,Node b){return a.a<b.a||a.a==b.a&&a.b<b.b;}
int fa[200200];
int find(int x){return fa[x]==x?x:fa[x]=find(fa[x]);}
int sta[200200],top;
Node en[200200];
double sl(Node x,Node y) { return (x.b-y.b)/(x.a-y.a); }
bool book[200200];
int main()
{
	scanf("%d",&n);
	int a,b;
	for(int i=1;i<=n;++i)
	{
		scanf("%d%d",&a,&b);
		poi[i].a=100.00/a;poi[i].b=100.00/b;
		poi[i].id=i;
		fa[i]=i;
	}
	sort(poi+1,poi+n+1,cmp);
	int tn=n,n=0;
	for(int i=1;i<=tn;++i)
	{
		if(poi[i].a==poi[n].a&&poi[i].b==poi[n].b)
		{
			fa[find(poi[i].id)]=find(poi[n].id);
			continue;
		}
		if(poi[i].a==poi[n].a)continue;
		poi[++n]=poi[i];
	}
	for(int i=1;i<=n;++i)
	{
		if(!top){sta[++top]=i;continue;}
		while(top>1&&sl(poi[i],poi[sta[top-1]])<
				sl(poi[sta[top]],poi[sta[top-1]]))top--;
		sta[++top]=i;
	}
	for(int i=1;i<=top;++i)
	{
		en[i]=poi[sta[i]];
//		cout<<"a: "<<en[i].a<<" b: "<<en[i].b<<" id: "<<en[i].id<<endl;
	}
	book[find(en[1].id)]=1;
	for(int i=1;i<top;++i)
		if(sl(en[i],en[i+1])<0)
		{
			book[find(en[i].id)]=book[find(en[i+1].id)]=1;
//			cout<<find(en[i].id)<<" "<<find(en[i+1].id)<<endl;
		}
//	for(int i=1;i<=tn;++i)cout<<book[i]<<" ";cout<<endl;
	for(int i=1;i<=tn;++i)
		if(book[find(i)])printf("%d ",i);
	puts("");
	return 0;
}


#include<bits/stdc++.h>
#define ll long long
#define ld long double
using namespace std;
inline ll read(){
    ll f=1,w=0;char x=0;
    while(!(x>='0'&&x<='9'))
    {
        x=getchar();
        if(x=='-') f=-1;
    }
    while(x>='0'&&x<='9')
    {
        w=(w<<3)+(w<<1)+(x^48);
        x=getchar();
    }
    return f*w;
}//习惯性的快读
struct people{
    ll a,b,id;
}p[300010];
ll n,s[300010],t;
bool v[300010],ans[300010];
bool cmp(people a,people b){
    if(a.a==b.a) return a.b>b.b;
    return a.a>b.a;
}//凸包排序
ld check(people a,people b){
    return (ld)a.a*b.a*(b.b-a.b)/(b.a-a.a)/b.b/a.b;
}//斜率的计算
int main(){
    n=read();
    for(int i=1;i<=n;i++) p[i].a=read(),p[i].b=read(),p[i].id=i;
    sort(p+1,p+n+1,cmp);
    s[1]=1,t=1;
    ll maxb=p[1].b;
    for(int i=2;i<=n;i++)
        if(p[i].b<=maxb) v[i]=1;
        else maxb=p[i].b;
    //去重和排除能一眼看出非答案的点，譬如a和b都比另一个点小
    for(int i=2;i<=n;i++)
    {
        if(v[i]||check(p[i],p[s[t]])>0) continue;//斜率大于0排除（并不知道有没有用
        while(t>1&&check(p[i],p[s[t]])<check(p[s[t-1]],p[s[t]]))
            t--;
        s[++t]=i;
    }//单调栈维护的类似于凸包的过程
    for(int i=1;i<=t;i++)
    {
        ans[p[s[i]].id]=1;
        for(int j=s[i]+1;j<=n&&p[s[i]].a==p[j].a&&p[s[i]].b==p[j].b;j++)
            ans[p[j].id]=1;
    }//还原位置相同的点
    for(int i=1;i<=n;i++)
        if(ans[i]) cout<<i<<" ";
    return 0;
}//题解


#include <bits/stdc++.h>
#define re register
using namespace std;
const int maxn=300010;
struct Point {
	int x,y,id;
} num[maxn];
inline bool cmp(Point a,Point b) {
	if(a.x<b.x) return true;
	if(a.x==b.x and a.y<b.y) return true;
	return false;
}
inline bool CJ(int a,int b,int c) {
	return (num[a].y-num[c].y)*(num[a].x-num[b].x)-(num[a].x-num[c].x)*(num[a].y-num[b].y);
}
int n,m,res,now,top,sta[maxn],ans[maxn],pd[maxn];
int main() {
	scanf("%d",&n);
	for ( re int i=1;i<=n;i++ )
		scanf("%d%d",&num[i].x,&num[i].y),num[i].id=i;
	sort(num+1,num+n+1,cmp);
	top=2,sta[1]=1,sta[2]=2;
	for ( re int i=3;i<=n;i++ ) {
		while(top>1 and CJ(sta[top-1],sta[top],i)) top--;
		sta[++top]=i;
	}
	for ( re int i=1;i<=top;i++ ) {
		ans[num[sta[i]].id]=1;
		for ( re int j=sta[i]+1;j<=n and num[sta[i]].x==num[j].x and num[sta[i]].y==num[j].y;j++ )
			ans[num[j].id]=1;
	}
	for ( re int i=1;i<=n;i++ ) if(ans[i]) printf("%d ",i);
	return 0;
}


#include <bits/stdc++.h>
#define int long long
#define re register
using namespace std;
const int maxn=300010;
struct Point {
	int x,y,id;
} num[maxn];
inline bool cmp(Point a,Point b) {
	if(a.x<b.x) return true;
	if(a.x==b.x and a.y<b.y) return true;
	return false;
}
inline bool CJ(int a,int b,int c) {
	return (num[a].y-num[c].y)*(num[a].x-num[b].x)-(num[a].x-num[c].x)*(num[a].y-num[b].y);
}
int n,m,res,now,top,sta[maxn],ans[maxn],pd[maxn];
signed main() {
	scanf("%lld",&n);
	for ( re int i=1;i<=n;i++ )
		scanf("%lld%lld",&num[i].x,&num[i].y),num[i].id=i;
	sort(num+1,num+n+1,cmp);
	top=2,sta[1]=1,sta[2]=2;
	for ( re int i=3;i<=n;i++ ) {
		while(top>1 and CJ(sta[top-1],sta[top],i)) top--;
		sta[++top]=i;
	}
	for ( re int i=1;i<=top;i++ ) {
		ans[sta[i]]=1;
		for ( re int j=sta[i]+1;j<=n and num[sta[i]].x==num[j].x and num[sta[i]].y==num[j].y;j++ )
			ans[num[j].id]=1;
	}
	for ( re int i=1;i<=n;i++ ) if(ans[i]) printf("%lld ",i);
	return 0;
}


#include <bits/stdc++.h>
#define re register
using namespace std;
const int maxn=2e5+5;
struct Point {
	int x,y,id;
} num[maxn];
inline bool cmp(Point a,Point b) {
	if(a.x<b.x) return true;
	if(a.x==b.x and a.y<b.y) return true;
	return false;
}
inline bool CJ(int a,int b,int c) {
	return (num[a].y-num[c].y)*(num[a].x-num[b].x)-(num[a].x-num[c].x)*(num[a].y-num[b].y);
}
int n,m,res,now,top,sta[maxn],ans[maxn],pd[maxn];
int main() {
	scanf("%d",&n);
	for ( re int i=1;i<=n;i++ )
		scanf("%d%d",&num[i].x,&num[i].y),num[i].id=i;
	sort(num+1,num+n+1,cmp);
	top=2,sta[1]=1,sta[2]=2;
	for ( re int i=3;i<=n;i++ ) {
		while(top>1 and CJ(sta[top-1],sta[top],i)) top--;
		sta[++top]=i;
	}
	for ( re int i=1;i<=top;i++ ) {
		ans[sta[i]]=1;
		for ( re int j=sta[i]+1;j<=n and num[sta[i]].x==num[j].x and num[sta[i]].y==num[j].y;j++ )
			ans[num[j].id]=1;
	}
	for ( re int i=1;i<=n;i++ ) if(ans[i]) printf("%d ",i);
	return 0;
}


#include <bits/stdc++.h>
#define re register
using namespace std;
const int maxn=300010;
struct Point {
	int x,y,id;
} num[maxn];
inline bool cmp(Point a,Point b) {
	if(a.x<b.x) return true;
	if(a.x==b.x and a.y<b.y) return true;
	return false;
}
inline bool CJ(int a,int b,int c) {
	return (num[a].y-num[c].y)*(num[a].x-num[b].x)-(num[a].x-num[c].x)*(num[a].y-num[b].y);
}
int n,m,res,now,top,sta[maxn],ans[maxn],pd[maxn];
int main() {
	scanf("%d",&n);
	for ( re int i=1;i<=n;i++ )
		scanf("%d%d",&num[i].x,&num[i].y),num[i].id=i;
	sort(num+1,num+n+1,cmp);
	top=2,sta[1]=1,sta[2]=2;
	for ( re int i=3;i<=n;i++ ) {
		while(top>1 and CJ(sta[top-1],sta[top],i)) top--;
		sta[++top]=i;
	}
	for ( re int i=1;i<=top;i++ ) {
		ans[sta[i]]=1;
		for ( re int j=sta[i]+1;j<=n and num[sta[i]].x==num[j].x and num[sta[i]].y==num[j].y;j++ )
			ans[num[j].id]=1;
	}
	for ( re int i=1;i<=n;i++ ) if(ans[i]) printf("%d ",i);
	return 0;
}


#include <cstdio>
#include <vector>
#include <algorithm>
using namespace std;

const int N = 200005;
int r[N], s[N], srt[N], mark[N];
vector<int> a;

int g[N];
int FIND(int x) { return g[x]==x? g[x]: g[x]=FIND(g[x]); }
void UNION(int x, int y) { g[FIND(x)] = FIND(y); }

bool cmp(int x, int y) {
  if (r[x] != r[y]) return r[x] > r[y];
  return s[x] > s[y];
}

bool leftTurn(int i, int j, int k) {
  return 1LL*(r[j]-r[k])*(s[i]-s[j])*r[i]*s[k]
      >  1LL*(s[j]-s[k])*(r[i]-r[j])*s[i]*r[k];
}

int main() {
  int n;
  scanf("%d", &n);
  for (int i = 0; i < n; i++) scanf("%d%d", &r[i], &s[i]);
  for (int i = 0; i < n; i++) srt[i] = g[i] = i;
  sort(srt, srt+n, cmp);
  for (int i = 0; i < n; i++) {
    if (i && r[srt[i]] == r[srt[i-1]] && s[srt[i]] == s[srt[i-1]]) {
      UNION(srt[i], srt[i-1]);
      continue;
    }
    while (a.size() >= 2 && leftTurn(a[a.size()-2], a[a.size()-1], srt[i]))
      a.pop_back();
    a.push_back(srt[i]);
  }
  while (a.size() >= 2
      && r[a[a.size()-2]] >= r[a[a.size()-1]]
      && s[a[a.size()-2]] >= s[a[a.size()-1]]) a.pop_back();
  for (auto &&x : a) mark[FIND(x)] = 1;
  for (int i = 0; i < n; i++) if (mark[FIND(i)] == 1) printf("%d ", i+1);
  puts("");
  return 0;
}


#include <cstdio>
#include <vector>
#include <algorithm>
using namespace std;

const int N = 200005;
int r[N], s[N], srt[N], mark[N];
vector<int> a;

int g[N];
int FIND(int x) { return g[x]==x? g[x]: g[x]=FIND(g[x]); }
void UNION(int x, int y) { g[FIND(x)] = FIND(y); }

bool cmp(int x, int y) {
  if (r[x] != r[y]) return r[x] > r[y];
  return s[x] > s[y];
}

bool leftTurn(int i, int j, int k) {
  return 1LL*(r[j]-r[k])*(s[i]-s[j])*r[i]*s[k]
      >  1LL*(s[j]-s[k])*(r[i]-r[j])*s[i]*r[k];
}

int main() {
  int n;
  scanf("%d", &n);
  for (int i = 0; i < n; i++) scanf("%d%d", &r[i], &s[i]);
  for (int i = 0; i < n; i++) srt[i] = i, g[i] = i;
  sort(srt, srt+n, cmp);
  r[n] = 0; s[n] = 1; srt[n] = n; n++;
  for (int i = 0; i < n; i++) {
    if (i && r[srt[i]] == r[srt[i-1]] && s[srt[i]] == s[srt[i-1]]) {
      UNION(srt[i], srt[i-1]);
      continue;
    }
    while (a.size() >= 2 && leftTurn(a[a.size()-2], a[a.size()-1], srt[i]))
      a.pop_back();
    a.push_back(srt[i]);
  }
  for (auto &&x : a) mark[FIND(x)] = 1;
  for (int i = 0; i < n-1; i++) if (mark[FIND(i)] == 1) printf("%d ", i+1);
  puts("");
  return 0;
}


#include <cstdio>
#include <vector>
#include <algorithm>
using namespace std;

const int N = 200005;
int r[N], s[N], srt[N], mark[N];
vector<int> a;

int g[N];
int FIND(int x) { return g[x]==x? g[x]: g[x]=FIND(g[x]); }
void UNION(int x, int y) { g[FIND(x)] = FIND(y); }

bool cmp(int x, int y) {
  if (r[x] != r[y]) return r[x] > r[y];
  return s[x] > s[y];
}

bool leftTurn(int i, int j, int k) {
  return 1LL*(r[j]-r[k])*(s[i]-s[j])*r[i]*s[k]
      >  1LL*(s[j]-s[k])*(r[i]-r[j])*s[i]*r[k];
}

int main() {
  int n;
  scanf("%d", &n);
  for (int i = 0; i < n; i++) scanf("%d%d", &r[i], &s[i]);
  for (int i = 0; i < n; i++) srt[i] = g[i] = i;
  sort(srt, srt+n, cmp);
  r[n] = 0; s[n] = 20001; srt[n] = g[n] = n; n++;
  for (int i = 0; i < n; i++) {
    if (i && r[srt[i]] == r[srt[i-1]] && s[srt[i]] == s[srt[i-1]]) {
      UNION(srt[i], srt[i-1]);
      continue;
    }
    while (a.size() >= 2 && leftTurn(a[a.size()-2], a[a.size()-1], srt[i]))
      a.pop_back();
    a.push_back(srt[i]);
  }
  for (auto &&x : a) mark[FIND(x)] = 1;
  for (int i = 0; i < n-1; i++) if (mark[FIND(i)] == 1) printf("%d ", i+1);
  puts("");
  return 0;
}


#include <cstdio>
#include <vector>
#include <algorithm>
using namespace std;

const int N = 200005;
int r[N], s[N], srt[N], mark[N];
vector<int> a;

int g[N];
int FIND(int x) { return g[x]==x? g[x]: g[x]=FIND(g[x]); }
void UNION(int x, int y) { g[FIND(x)] = FIND(y); }

bool cmp(int x, int y) {
  if (r[x] != r[y]) return r[x] > r[y];
  return s[x] > s[y];
}

bool leftTurn(int i, int j, int k) {
  return 1LL*(r[j]-r[k])*(s[i]-s[j])*r[i]*s[k]
      >  1LL*(s[j]-s[k])*(r[i]-r[j])*s[i]*r[k];
}

int main() {
  int n;
  scanf("%d", &n);
  for (int i = 0; i < n; i++) scanf("%d%d", &r[i], &s[i]);
  for (int i = 0; i < n; i++) srt[i] = i, g[i] = i;
  sort(srt, srt+n, cmp);
  r[n] = 0; s[n] = 20001; srt[n] = n; n++;
  for (int i = 0; i < n; i++) {
    if (i && r[srt[i]] == r[srt[i-1]] && s[srt[i]] == s[srt[i-1]]) {
      UNION(srt[i], srt[i-1]);
      continue;
    }
    while (a.size() >= 2 && leftTurn(a[a.size()-2], a[a.size()-1], srt[i]))
      a.pop_back();
    a.push_back(srt[i]);
  }
  for (auto &&x : a) mark[FIND(x)] = 1;
  for (int i = 0; i < n-1; i++) if (mark[FIND(i)] == 1) printf("%d ", i+1);
  puts("");
  return 0;
}


#include <iostream>
#include <vector>
using namespace std;

const int N = 200005;
int r[N], s[N], srt[N], mark[N];
vector<int> a;

int g[N];
int FIND(int x) { return g[x]==x? g[x]: g[x]=FIND(g[x]); }
void UNION(int x, int y) { g[FIND(x)] = FIND(y); }

bool cmp(int x, int y) {
  if (r[x] != r[y]) return r[x] > r[y];
  return s[x] > s[y];
}

bool leftTurn(int i, int j, int k) {
  return 1LL*(r[j]-r[k])*(s[i]-s[j])*r[i]*s[k]
      >  1LL*(s[j]-s[k])*(r[i]-r[j])*s[i]*r[k];
}

int main() {
  int n;
  scanf("%d", &n);
  for (int i = 0; i < n; i++) scanf("%d%d", &r[i], &s[i]);
  for (int i = 0; i < n; i++) srt[i] = i, g[i] = i;
  sort(srt, srt+n, cmp);
  r[n] = 0; s[n] = 1; srt[n] = n; n++;
  for (int i = 0; i < n; i++) {
    if (i && r[srt[i]] == r[srt[i-1]] && s[srt[i]] == s[srt[i-1]]) {
      UNION(srt[i], srt[i-1]);
      continue;
    }
    while (a.size() >= 2 && leftTurn(a[a.size()-2], a[a.size()-1], srt[i]))
      a.pop_back();
    a.push_back(srt[i]);
  }
  for (auto &&x : a) mark[FIND(x)] = 1;
  for (int i = 0; i < n-1; i++) if (mark[FIND(i)] == 1) printf("%d ", i+1);
  puts("");
  return 0;
}


#include <cstdio>
#include <vector>
#include <algorithm>
using namespace std;

const int N = 200005;
int r[N], s[N], srt[N], mark[N];
vector<int> a;

int g[N];
int FIND(int x) { return g[x]==x? g[x]: g[x]=FIND(g[x]); }
void UNION(int x, int y) { g[FIND(x)] = FIND(y); }

bool cmp(int x, int y) {
  if (r[x] != r[y]) return r[x] > r[y];
  return s[x] < s[y];
}

bool leftTurn(int i, int j, int k) {
  return 1LL*(r[j]-r[k])*(s[i]-s[j])*r[i]*s[k]
      >  1LL*(s[j]-s[k])*(r[i]-r[j])*s[i]*r[k];
}

int main() {
  int n;
  scanf("%d", &n);
  for (int i = 0; i < n; i++) scanf("%d%d", &r[i], &s[i]);
  for (int i = 0; i < n; i++) srt[i] = g[i] = i;
  sort(srt, srt+n, cmp);
  r[n] = 0; s[n] = 20001; srt[n] = g[n] = n; n++;
  for (int i = 0; i < n; i++) {
    if (i && r[srt[i]] == r[srt[i-1]] && s[srt[i]] == s[srt[i-1]]) {
      UNION(srt[i], srt[i-1]);
      continue;
    }
    while (a.size() >= 2 && leftTurn(a[a.size()-2], a[a.size()-1], srt[i]))
      a.pop_back();
    a.push_back(srt[i]);
  }
  for (auto &&x : a) mark[FIND(x)] = 1;
  for (int i = 0; i < n-1; i++) if (mark[FIND(i)] == 1) printf("%d ", i+1);
  puts("");
  return 0;
}


#include <cstdio>
#include <vector>
using namespace std;

const int N = 200005;
int r[N], s[N], srt[N], mark[N];
vector<int> a;

int g[N];
int FIND(int x) { return g[x]==x? g[x]: g[x]=FIND(g[x]); }
void UNION(int x, int y) { g[FIND(x)] = FIND(y); }

bool cmp(int x, int y) {
  if (r[x] != r[y]) return r[x] > r[y];
  return s[x] > s[y];
}

bool leftTurn(int i, int j, int k) {
  return 1LL*(r[j]-r[k])*(s[i]-s[j])*r[i]*s[k]
      >  1LL*(s[j]-s[k])*(r[i]-r[j])*s[i]*r[k];
}

int main() {
  int n;
  scanf("%d", &n);
  for (int i = 0; i < n; i++) scanf("%d%d", &r[i], &s[i]);
  for (int i = 0; i < n; i++) srt[i] = i, g[i] = i;
  sort(srt, srt+n, cmp);
  r[n] = 0; s[n] = 1; srt[n] = n; n++;
  for (int i = 0; i < n; i++) {
    if (i && r[srt[i]] == r[srt[i-1]] && s[srt[i]] == s[srt[i-1]]) {
      UNION(srt[i], srt[i-1]);
      continue;
    }
    while (a.size() >= 2 && leftTurn(a[a.size()-2], a[a.size()-1], srt[i]))
      a.pop_back();
    a.push_back(srt[i]);
  }
  for (auto &&x : a) mark[FIND(x)] = 1;
  for (int i = 0; i < n-1; i++) if (mark[FIND(i)] == 1) printf("%d ", i+1);
  puts("");
  return 0;
}


#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
const int N = 2e5+5;
const int mod = 1e9 + 7;
typedef long long ll;
pair<ll,ll> intersect(pair<ll,ll> a, pair<ll,ll> b){
  return make_pair(a.first * (b.second - a.second), a.second * (b.first - a.first));
}
bool cmp(pair<ll,ll> a, pair<ll,ll> b){
  /// a.f / a.s < b.f / b.s
  /// a.f * b.s < b.f * a.s
  return a.first * b.second < b.first * a.second;
}
vector<pair<int,int>>pts;
int a[N], b[N];
vector<pair<int,int>> ConvexHull(vector<pair<int,int>> vp){

  while(vp.size() > 1 && vp.back().first <= vp[vp.size()-2].first && vp.back().second <= vp[vp.size()-2].second)
    vp.pop_back();
  return vp;
}
int main(){
  ios::sync_with_stdio(false);

  int n; cin >> n;

  for(int i = 0; i < n; i++){
    cin >> a[i] >> b[i];
    pts.push_back({a[i],b[i]});
  }

  sort(pts.begin(),pts.end());

  vector<pair<int,int>>upperHull;
  for(int i = 0; i < pts.size(); i++){
    while(upperHull.size() > 1 && cmp(intersect(pts[i],upperHull.back()), intersect(upperHull[upperHull.size()-2],upperHull.back())))
      upperHull.pop_back();
    upperHull.push_back(pts[i]);
  }

  upperHull = ConvexHull(upperHull);

  set<pair<int,int>>st;
  for(auto x : upperHull)st.insert(x);

  for(int i = 0; i < n ; i++){
    if(st.count(make_pair(a[i],b[i])))
      cout << i + 1 << ' ';
  }

}


#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
const int N = 2e5+5;
const int mod = 1e9 + 7;
typedef long long ll;
pair<ll,ll> intersect(pair<ll,ll> a, pair<ll,ll> b){
  return make_pair(a.first * (b.second - a.second), a.second * (b.first - a.first));
}
bool cmp(pair<ll,ll> a, pair<ll,ll> b){
  /// a.f / a.s < b.f / b.s
  /// a.f * b.s < b.f * a.s
  return a.first * b.second < b.first * a.second;
}
vector<pair<int,int>>pts;
int a[N], b[N];
vector<pair<int,int>> ConvexHull(vector<pair<int,int>> vp){

    sort(vp.begin(),vp.end());
    vector<pair<int,int>>hull;
    for(int i = 0; i < vp.size(); i++){
      while(!hull.empty() && hull.back().second <= vp[i].second)
        hull.pop_back();
      hull.push_back(vp[i]);
    }
  return hull;
}
int main(){
  ios::sync_with_stdio(false);

  int n; cin >> n;

  for(int i = 0; i < n; i++){
    cin >> a[i] >> b[i];
    pts.push_back({a[i],b[i]});
  }

  sort(pts.begin(),pts.end());

  pts = ConvexHull(pts);

  vector<pair<int,int>>upperHull;
  for(int i = 0; i < pts.size(); i++){
    while(upperHull.size() > 1 && cmp(intersect(pts[i],upperHull.back()), intersect(upperHull[upperHull.size()-2],upperHull.back())))
      upperHull.pop_back();
    upperHull.push_back(pts[i]);
  }

  set<pair<int,int>>st;
  for(auto x : upperHull)st.insert(x);

  for(int i = 0; i < n ; i++){
    if(st.count(make_pair(a[i],b[i])))
      cout << i + 1 << ' ';
  }

}


#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
const int N = 2e5+5;
const int mod = 1e9 + 7;
typedef long long ll;
pair<ll,ll> intersect(pair<ll,ll> a, pair<ll,ll> b){
  return make_pair(a.first * (b.second - a.second), a.second * (b.first - a.first));
}
bool cmp(pair<ll,ll> a, pair<ll,ll> b){
  /// a.f / a.s < b.f / b.s
  /// a.f * b.s < b.f * a.s
  return a.first * b.second < b.first * a.second;
}
vector<pair<int,int>>pts;
int a[N], b[N];
vector<pair<int,int>> ConvexHull(vector<pair<int,int>> vp){

  while(vp.size() > 1 && vp.back().first <= vp[vp.size()-2].first && vp.back().second <= vp[vp.size()-2].second)
    vp.pop_back();
  return vp;
}
int main(){
  ios::sync_with_stdio(false);

  int n; cin >> n;

  for(int i = 0; i < n; i++){
    cin >> a[i] >> b[i];
    pts.push_back({a[i],b[i]});
  }

  sort(pts.rbegin(),pts.rend());

  vector<pair<int,int>>upperHull;
  for(int i = 0; i < pts.size(); i++){
    while(upperHull.size() > 1 && cmp(intersect(pts[i],upperHull.back()), intersect(upperHull[upperHull.size()-2],upperHull.back())))
      upperHull.pop_back();
    upperHull.push_back(pts[i]);
  }

  upperHull = ConvexHull(upperHull);

  set<pair<int,int>>st;
  for(auto x : upperHull)st.insert(x);

  for(int i = 0; i < n ; i++){
    if(st.count(make_pair(a[i],b[i])))
      cout << i + 1 << ' ';
  }

}


#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
const int N = 2e5+5;
const int mod = 1e9 + 7;
typedef long long ll;
pair<ll,ll> intersect(pair<ll,ll> a, pair<ll,ll> b){
  return make_pair(a.first * (b.second - a.second), a.second * (b.first - a.first));
}
bool cmp(pair<ll,ll> a, pair<ll,ll> b){
  /// a.f / a.s < b.f / b.s
  /// a.f * b.s < b.f * a.s
  return a.first * b.second < b.first * a.second;
}
vector<pair<int,int>>pts;
int a[N], b[N];
vector<pair<int,int>> ConvexHull(vector<pair<int,int>> vp){

  sort(vp.begin(),vp.end());
  vector<pair<int,int>>hull;
  for(int i = 0; i < vp.size(); i++){
    while(!hull.empty() && hull.back().second <= vp[i].second)
      hull.pop_back();
    hull.push_back(vp[i]);
  }
  return hull;
}
int main(){
  ios::sync_with_stdio(false);

  int n; cin >> n;

  for(int i = 0; i < n; i++){
    cin >> a[i] >> b[i];
    pts.push_back({a[i],b[i]});
  }

  sort(pts.begin(),pts.end());

  vector<pair<int,int>>upperHull;
  for(int i = 0; i < pts.size(); i++){
    while(upperHull.size() > 1 && cmp(intersect(pts[i],upperHull.back()), intersect(upperHull[upperHull.size()-2],upperHull.back())))
      upperHull.pop_back();
    upperHull.push_back(pts[i]);
  }

  upperHull = ConvexHull(upperHull);

  set<pair<int,int>>st;
  for(auto x : upperHull)st.insert(x);

  for(int i = 0; i < n ; i++){
    if(st.count(make_pair(a[i],b[i])))
      cout << i + 1 << ' ';
  }

}


#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
const int N = 2e5+5;
const int mod = 1e9 + 7;
typedef long long ll;
pair<ll,ll> intersect(pair<ll,ll> a, pair<ll,ll> b){
  return make_pair(a.first * (b.second - a.second), a.second * (b.first - a.first));
}
bool cmp(pair<ll,ll> a, pair<ll,ll> b){
  /// a.f / a.s < b.f / b.s
  /// a.f * b.s < b.f * a.s
  return a.first * b.second < b.first * a.second;
}
vector<pair<int,int>>pts;
int a[N], b[N];
vector<pair<int,int>> ConvexHull(vector<pair<int,int>> vp){

  sort(vp.begin(),vp.end());
  vector<pair<int,int>>hull;
  for(int i = 0; i < vp.size(); i++){
    while(!hull.empty() && hull.back().second <= vp[i].second)
      hull.pop_back();
    hull.push_back(vp[i]);
  }
  return hull;
}
int main(){
  ios::sync_with_stdio(false);

  int n; cin >> n;

  for(int i = 0; i < n; i++){
    cin >> a[i] >> b[i];
    pts.push_back({a[i],b[i]});
  }

  sort(pts.begin(),pts.end());

  vector<pair<int,int>>upperHull;
  for(int i = 0; i < pts.size(); i++){
    while(upperHull.size() > 1 && cmp(intersect(pts[i],upperHull.back()), intersect(upperHull[upperHull.size()-2],upperHull.back())))
      upperHull.pop_back();
    upperHull.push_back(pts[i]);
  }

  pts = ConvexHull(pts);

  set<pair<int,int>>st;
  for(auto x : upperHull)st.insert(x);

  for(int i = 0; i < n ; i++){
    if(st.count(make_pair(a[i],b[i])))
      cout << i + 1 << ' ';
  }

}


#include "bits/stdc++.h"
using namespace std;
typedef long long ll;
const int N = 2e5+5;
const int mod = 1e9 + 7;
typedef long long ll;
pair<ll,ll> intersect(pair<ll,ll> a, pair<ll,ll> b){
  return make_pair(a.first * (b.second - a.second), a.second * (b.first - a.first));
}
bool cmp(pair<ll,ll> a, pair<ll,ll> b){
  /// a.f / a.s < b.f / b.s
  /// a.f * b.s < b.f * a.s
  return a.first * b.second < b.first * a.second;
}
vector<pair<int,int>>pts;
int a[N], b[N];
vector<pair<int,int>> ConvexHull(vector<pair<int,int>> vp){
  sort(vp.begin(),vp.end());
  while(vp.size() > 1 && vp.back().first <= vp[vp.size()-2].first && vp.back().second <= vp[vp.size()-2].second)
    vp.pop_back();
  return vp;
}
int main(){
  ios::sync_with_stdio(false);

  int n; cin >> n;

  for(int i = 0; i < n; i++){
    cin >> a[i] >> b[i];
    pts.push_back({a[i],b[i]});
  }

  sort(pts.rbegin(),pts.rend());

  vector<pair<int,int>>upperHull;
  for(int i = 0; i < pts.size(); i++){
    while(upperHull.size() > 1 && cmp(intersect(pts[i],upperHull.back()), intersect(upperHull[upperHull.size()-2],upperHull.back())))
      upperHull.pop_back();
    upperHull.push_back(pts[i]);
  }

  upperHull = ConvexHull(upperHull);

  set<pair<int,int>>st;
  for(auto x : upperHull)st.insert(x);

  for(int i = 0; i < n ; i++){
    if(st.count(make_pair(a[i],b[i])))
      cout << i + 1 << ' ';
  }

}


#include<cstdio>
#include<iostream>
#include<algorithm>
#include<cstring>
#include<cmath>
#include<vector>
using namespace std;
typedef pair<int, int> pii;
const int maxn = 200005;
const double eps = 1e-9;

int n, b[maxn], c[maxn], stak[maxn], top, ans[maxn], cnt;
pii p[maxn];
vector<int> G[maxn];

struct node{
	double fir, sec;
	node(){}
	node(double x, double y) {
		fir = x;
		sec = y;
	}
}a[maxn];

node operator - (node x, node y)
{
	return node(x.fir - y.fir, x.sec - y.sec);
}

double slop(node x)
{
	return x.sec / x.fir;
}

bool cmp(int x, int y)
{
	return a[x].fir < a[y].fir;
}

bool cmp1(int x, int y)
{
	return p[x].first != p[y].first? p[x].first < p[y].first: p[x].second < p[y].second;
}

int main()
{
	scanf("%d", &n);
	for(int i = 1; i <= n; ++i)
	{
		scanf("%lf%lf", &a[i].fir, &a[i].sec);
		a[i].fir = 1.0 / a[i].fir;
		a[i].sec = 1.0 / a[i].sec;
		b[i] = i;
	}
	sort(b + 1, b + n + 1, cmp);
	int m = 0;
	for(int i = 1; i <= n; ++i)
	{
		if(!m || fabs(a[b[i]].fir - a[b[i-1]].fir) > eps)
		{
			++ m;
			a[m] = a[b[i]];
			G[m].push_back(b[i]);
		}
		else if(fabs(a[b[i]].sec - a[b[i-1]].sec) < eps)
		{
			G[m].push_back(b[i]);
		}
	}
	//sort(c + 1, c + m + 1, cmp);
	for(int i = 1; i <= m; ++i)
	{
		while(top > 1 && slop(a[stak[top]] - a[stak[top-1]]) > slop(a[i] - a[stak[top-1]]))	-- top;
		stak[++top] = i;
	}
	for(int i = 0; i < G[stak[1]].size(); ++i)
		ans[++cnt] = G[stak[1]][i];
	for(int i = 2; i <= top; ++i)
	{
		node u = a[stak[i]] - a[stak[i-1]];
		if(slop(u) < 0)
		{
			for(int j = 0; j < G[stak[i]].size(); ++i)
				ans[++cnt] = G[stak[i]][j];
		}
		else
		{
			break;
		}
	}
	sort(ans + 1, ans + cnt + 1);
	for(int i = 1; i <= cnt; ++i)
		printf("%d ", ans[i]);
	return 0;
}


#include<cstdio>
#include<iostream>
#include<algorithm>
#include<cstring>
#include<cmath>
#include<vector>
using namespace std;
typedef pair<int, int> pii;
const int maxn = 200005;
const double eps = 1e-9;

int n, b[maxn], c[maxn], stak[maxn], top, ans[maxn], cnt;
pii p[maxn];
vector<int> G[maxn];

struct node{
	double fir, sec;
	node(){}
	node(double x, double y) {
		fir = x;
		sec = y;
	}
}a[maxn];

node operator - (node x, node y)
{
	return node(x.fir - y.fir, x.sec - y.sec);
}

double crp(node x, node y)
{
	return x.fir * y.sec - x.sec * y.fir;
}

bool cmp(int x, int y)
{
	return fabs(a[x].fir - a[y].fir) < eps? a[x].sec > a[y].sec: a[x].fir < a[y].fir;
}

bool cmp1(int x, int y)
{
	return p[x] < p[y];
}

int main()
{
	scanf("%d", &n);
	for(int i = 1; i <= n; ++i)
	{
		scanf("%d%d", &p[i].first, &p[i].second);
		b[i] = i;
	}
	sort(b + 1, b + n + 1, cmp1);
	int m = 0;
	for(int l = 1, r; l <= n; l = r + 1)
	{
		r = l;
		while(r < n && p[b[l]] == p[b[r+1]])	++ r;
		++ m;
		c[m] = m;
		a[m] = node(1.0 / p[b[l]].first, 1.0 / p[b[l]].second);
		for(int j = l; j <= r; ++j)
			G[m].push_back(b[j]);
	}
	sort(c + 1, c + m + 1, cmp);
	for(int i = 1; i <= m; ++i)
	{
		while(top > 1 && crp(a[stak[top]] - a[stak[top-1]], a[c[i]] - a[stak[top-1]]) < 0)	-- top;
		stak[++top] = c[i];
	}
	for(int i = top; i > 1; --i)
	{
		node u = a[stak[i]] - a[stak[i-1]];
		if(u.sec > -eps)
			-- top;
		else
			break;
	}
	for(int i = 1; i <= top; ++i)
		for(int j = 0; j < G[stak[i]].size(); ++i)
			ans[++cnt] = G[stak[i]][j];
	sort(ans + 1, ans + cnt + 1);
	for(int i = 1; i <= cnt; ++i)
		printf("%d ", ans[i]);
	return 0;
}


#include<cstdio>
#include<iostream>
#include<algorithm>
#include<cstring>
#include<cmath>
#include<vector>
using namespace std;
typedef pair<int, int> pii;
const int maxn = 200005;
const double eps = 1e-9;

int n, b[maxn], c[maxn], stak[maxn], top, ans[maxn], cnt;
pii p[maxn];
vector<int> G[maxn];

struct node{
	double fir, sec;
	node(){}
	node(double x, double y) {
		fir = x;
		sec = y;
	}
}a[maxn];

node operator - (node x, node y)
{
	return node(x.fir - y.fir, x.sec - y.sec);
}

double slop(node x)
{
	return x.sec / x.fir;
}

bool cmp(int x, int y)
{
	return fabs(a[x].fir - a[y].fir) < eps? a[x].sec > a[y].sec: a[x].fir < a[y].fir;
}

bool cmp1(int x, int y)
{
	return p[x] < p[y];
}

int main()
{
	scanf("%d", &n);
	for(int i = 1; i <= n; ++i)
	{
		scanf("%d%d", &p[i].first, &p[i].second);
		b[i] = i;
	}
	sort(b + 1, b + n + 1, cmp1);
	int m = 0;
	for(int l = 1, r; l <= n; l = r + 1)
	{
		r = l;
		while(r < n && p[b[l]] == p[b[r+1]])	++ r;
		if(r < n && p[b[r]].first == p[b[r+1]].first)	continue;
		++ m;
		c[m] = m;
		a[m] = node(1.0 / p[b[l]].first, 1.0 / p[b[l]].second);
		for(int j = l; j <= r; ++j)
			G[m].push_back(b[j]);
	}
	sort(c + 1, c + m + 1, cmp);
	for(int i = 1; i <= m; ++i)
	{
		while(top > 1 && slop(a[stak[top]] - a[stak[top-1]]) > slop(a[c[i]] - a[stak[top-1]]))	-- top;
		stak[++top] = c[i];
	}
	for(int i = 0; i < G[stak[1]].size(); ++i)
		ans[++cnt] = G[stak[1]][i];
	for(int i = 2; i <= top; ++i)
	{
		node u = a[stak[i]] - a[stak[i-1]];
		if(u.sec < 0)
		{
			for(int j = 0; j < G[stak[i]].size(); ++i)
				ans[++cnt] = G[stak[i]][j];
		}
		else
		{
			break;
		}
	}
	sort(ans + 1, ans + cnt + 1);
	for(int i = 1; i <= cnt; ++i)
		printf("%d ", ans[i]);
	return 0;
}


#include<cstdio>
#include<iostream>
#include<algorithm>
#include<cstring>
#include<cmath>
#include<vector>
using namespace std;
typedef pair<int, int> pii;
const int maxn = 200005;
const double eps = 1e-9;

int n, b[maxn], c[maxn], stak[maxn], top, ans[maxn], cnt;
pii p[maxn];
vector<int> G[maxn];

struct node{
	double fir, sec;
	node(){}
	node(double x, double y) {
		fir = x;
		sec = y;
	}
}a[maxn];

node operator - (node x, node y)
{
	return node(x.fir - y.fir, x.sec - y.sec);
}

double crp(node x, node y)
{
	return x.fir * y.sec - x.sec * y.fir;
}

bool cmp(int x, int y)
{
	return fabs(a[x].fir - a[y].fir) < eps? a[x].sec > a[y].sec: a[x].fir < a[y].fir;
}

bool cmp1(int x, int y)
{
	return p[x] < p[y];
}

int main()
{
	scanf("%d", &n);
	for(int i = 1; i <= n; ++i)
	{
		scanf("%d%d", &p[i].first, &p[i].second);
		b[i] = i;
	}
	sort(b + 1, b + n + 1, cmp1);
	int m = 0;
	for(int l = 1, r; l <= n; l = r + 1)
	{
		r = l;
		while(r < n && p[b[l]] == p[b[r+1]])	++ r;
		++ m;
		c[m] = m;
		a[m] = node(1.0 / p[b[l]].first, 1.0 / p[b[l]].second);
		for(int j = l; j <= r; ++j)
			G[m].push_back(b[j]);
	}
	sort(c + 1, c + m + 1, cmp);
	for(int i = 1; i <= n; ++i)
	{
		while(top > 1 && crp(a[stak[top]] - a[stak[top-1]], a[c[i]] - a[stak[top-1]]) < 0)	-- top;
		stak[++top] = c[i];
	}
	for(int i = top; i > 1; --i)
	{
		node u = a[stak[i]] - a[stak[i-1]];
		if(u.sec > 0)
			-- top;
		else
			++ top;
	}
	for(int i = 1; i <= top; ++i)
		for(int j = 0; j < G[stak[i]].size(); ++i)
			ans[++cnt] = G[stak[i]][j];
	sort(ans + 1, ans + cnt + 1);
	for(int i = 1; i <= cnt; ++i)
		printf("%d ", ans[i]);
	return 0;
}


#include<cstdio>
#include<iostream>
#include<algorithm>
#include<cstring>
#include<cmath>
#include<vector>
using namespace std;
const int maxn = 200005;
const double eps = 1e-9;

int n, b[maxn], stak[maxn], top, ans[maxn], cnt;
vector<int> G[maxn];

struct node{
	double fir, sec;
	node(){}
	node(double x, double y) {
		fir = x;
		sec = y;
	}
}a[maxn], c[maxn];

node operator - (node x, node y)
{
	return node(x.fir - y.fir, x.sec - y.sec);
}

double slop(node x)
{
	return x.sec / x.fir;
}

bool cmp(int x, int y)
{
	return c[x].fir < c[y].fir;
}

int main()
{
	scanf("%d", &n);
	for(int i = 1; i <= n; ++i)
	{
		scanf("%lf%lf", &c[i].fir, &c[i].sec);
		c[i].fir = 1.0 / c[i].fir;
		c[i].sec = 1.0 / c[i].sec;
		b[i] = i;
	}
	sort(b + 1, b + n + 1, cmp);
	int m = 0;
	for(int i = 1; i <= n; ++i)
	{
		if(!m || fabs(c[b[i]].fir - c[b[i-1]].fir) > eps)
		{
			++ m;
			a[m] = c[b[i]];
			G[m].push_back(b[i]);
		}
		else if(fabs(c[b[i]].sec - c[b[i-1]].sec) < eps)
		{
			G[m].push_back(b[i]);
		}
	}
	for(int i = 1; i <= m; ++i)
	{
		while(top > 1 && slop(a[stak[top]] - a[stak[top-1]]) > slop(a[i] - a[stak[top-1]]))	-- top;
		stak[++top] = i;
	}
	for(int i = 0; i < G[stak[1]].size(); ++i)
		ans[++cnt] = G[stak[1]][i];
	for(int i = 2; i <= top; ++i)
	{
		node u = a[stak[i]] - a[stak[i-1]];
		if(slop(u) < 0)
		{
			for(int j = 0; j < G[stak[i]].size(); ++i)
				ans[++cnt] = G[stak[i]][j];
		}
		else
		{
			break;
		}
	}
	sort(ans + 1, ans + cnt + 1);
	for(int i = 1; i <= cnt; ++i)
		printf("%d ", ans[i]);
	return 0;
}


#include<cstdio>
#include<iostream>
#include<algorithm>
#include<cstring>
#include<cmath>
#include<vector>
using namespace std;
typedef pair<int, int> pii;
const int maxn = 200005;
const double eps = 1e-9;

int n, b[maxn], c[maxn], stak[maxn], top, ans[maxn], cnt;
pii p[maxn];
vector<int> G[maxn];

struct node{
	double fir, sec;
	node(){}
	node(double x, double y) {
		fir = x;
		sec = y;
	}
}a[maxn];

node operator - (node x, node y)
{
	return node(x.fir - y.fir, x.sec - y.sec);
}

double crp(node x, node y)
{
	return x.fir * y.sec - x.sec * y.fir;
}

bool cmp(int x, int y)
{
	return fabs(a[x].fir - a[y].fir) < eps? a[x].sec > a[y].sec: a[x].fir < a[y].fir;
}

bool cmp1(int x, int y)
{
	return p[x] < p[y];
}

int main()
{
	scanf("%d", &n);
	for(int i = 1; i <= n; ++i)
	{
		scanf("%d%d", &p[i].first, &p[i].second);
		b[i] = i;
	}
	sort(b + 1, b + n + 1, cmp1);
	int m = 0;
	for(int l = 1, r; l <= n; l = r + 1)
	{
		r = l;
		while(r < n && p[b[l]] == p[b[r+1]])	++ r;
		++ m;
		c[m] = m;
		a[m] = node(1.0 / p[b[l]].first, 1.0 / p[b[l]].second);
		for(int j = l; j <= r; ++j)
			G[m].push_back(b[j]);
	}
	sort(c + 1, c + m + 1, cmp);
	for(int i = 1; i <= m; ++i)
	{
		while(top > 1 && crp(a[stak[top]] - a[stak[top-1]], a[c[i]] - a[stak[top-1]]) < 0)	-- top;
		stak[++top] = c[i];
	}
	for(int i = top; i > 1; --i)
	{
		node u = a[stak[i]] - a[stak[i-1]];
		if(u.sec > 0)
			-- top;
		else
			++ top;
	}
	for(int i = 1; i <= top; ++i)
		for(int j = 0; j < G[stak[i]].size(); ++i)
			ans[++cnt] = G[stak[i]][j];
	sort(ans + 1, ans + cnt + 1);
	for(int i = 1; i <= cnt; ++i)
		printf("%d ", ans[i]);
	return 0;
}


#include<cstdio>
#include<iostream>
#include<algorithm>
#include<cstring>
#include<cmath>
#include<vector>
using namespace std;
typedef pair<int, int> pii;
const int maxn = 200005;
const double eps = 1e-9;

int n, b[maxn], c[maxn], stak[maxn], top, ans[maxn], cnt;
pii p[maxn];
vector<int> G[maxn];

struct node{
	double fir, sec;
	node(){}
	node(double x, double y) {
		fir = x;
		sec = y;
	}
}a[maxn];

node operator - (node x, node y)
{
	return node(x.fir - y.fir, x.sec - y.sec);
}

double crp(node x, node y)
{
	return x.fir * y.sec - x.sec * y.fir;
}

bool cmp(int x, int y)
{
	return fabs(a[x].fir - a[y].fir) < eps? a[x].sec > a[y].sec: a[x].fir < a[y].fir;
}

bool cmp1(int x, int y)
{
	return p[x] < p[y];
}

int main()
{
	scanf("%d", &n);
	for(int i = 1; i <= n; ++i)
	{
		scanf("%d%d", &p[i].first, &p[i].second);
		b[i] = i;
	}
	sort(b + 1, b + n + 1, cmp1);
	int m = 0;
	for(int l = 1, r; l <= n; l = r + 1)
	{
		r = l;
		while(r < n && p[b[l]] == p[b[r+1]])	++ r;
		if(r < n && p[b[r]].first == p[b[r+1]].first)	continue;
		++ m;
		c[m] = m;
		a[m] = node(1.0 / p[b[l]].first, 1.0 / p[b[l]].second);
		for(int j = l; j <= r; ++j)
			G[m].push_back(b[j]);
	}
	sort(c + 1, c + m + 1, cmp);
	for(int i = 1; i <= m; ++i)
	{
		while(top > 1 && crp(a[stak[top]] - a[stak[top-1]], a[c[i]] - a[stak[top-1]]) < 0)	-- top;
		stak[++top] = c[i];
	}
	for(int i = top; i > 1; --i)
	{
		node u = a[stak[i]] - a[stak[i-1]];
		if(u.sec > -eps)
			-- top;
		else
			break;
	}
	for(int i = 1; i <= top; ++i)
		for(int j = 0; j < G[stak[i]].size(); ++i)
			ans[++cnt] = G[stak[i]][j];
	sort(ans + 1, ans + cnt + 1);
	for(int i = 1; i <= cnt; ++i)
		printf("%d ", ans[i]);
	return 0;
}


#include<cstdio>
#include<iostream>
#include<algorithm>
#include<cstring>
#include<cmath>
using namespace std;
const int maxn = 200005;
const double eps = 1e-9;

int n, b[maxn], stak[maxn], top;

struct node{
	double fir, sec;
	node(){}
	node(double x, double y) {
		fir = x;
		sec = y;
	}
}a[maxn];

node operator - (node x, node y)
{
	return node(x.fir - y.fir, x.sec - y.sec);
}

double crp(node x, node y)
{
	return x.fir * y.sec - x.sec * y.fir;
}

bool cmp(int x, int y)
{
	return fabs(a[x].fir - a[y].fir) < eps? a[x].sec > a[y].sec: a[x].fir < a[y].fir;
}

int main()
{
	scanf("%d", &n);
	for(int i = 1; i <= n; ++i)
	{
		scanf("%lf%lf", &a[i].fir, &a[i].sec);
		a[i].fir = 1 / a[i].fir;
		a[i].sec = 1 / a[i].sec;
		b[i] = i;
	}
	sort(b + 1, b + n + 1, cmp);
	for(int i = 1; i <= n; ++i)
	{
		while(top > 1 && crp(a[stak[top]] - a[stak[top-1]], a[b[i]] - a[stak[top-1]]) < 0)	-- top;
		stak[++top] = b[i];
	}
	sort(stak + 1, stak + top + 1);
	for(int i = 1; i <= top; ++i)
		printf("%d ", stak[i]);
	return 0;
}


#include<cstdio>
#include<iostream>
#include<algorithm>
#include<cstring>
#include<cmath>
using namespace std;
const int maxn = 200005;
const double eps = 1e-9;

int n, b[maxn], stak[maxn], top;

struct node{
	double fir, sec;
	node(){}
	node(double x, double y) {
		fir = x;
		sec = y;
	}
}a[maxn];

node operator - (node x, node y)
{
	return node(x.fir - y.fir, x.sec - y.sec);
}

double crp(node x, node y)
{
	return x.fir * y.sec - x.sec * y.fir;
}

bool cmp(int x, int y)
{
	return fabs(a[x].fir - a[y].fir) < eps? a[x].sec > a[y].sec: a[x].fir < a[y].fir;
}

int main()
{
	scanf("%d", &n);
	for(int i = 1; i <= n; ++i)
	{
		scanf("%lf%lf", &a[i].fir, &a[i].sec);
		a[i].fir = 1 / a[i].fir;
		a[i].sec = 1 / a[i].sec;
		b[i] = i;
	}
	sort(b + 1, b + n + 1, cmp);
	for(int i = 1; i <= n; ++i)
	{
		while(top > 1 && crp(a[stak[top]] - a[stak[top-1]], a[b[i]] - a[stak[top-1]]) < 0)	-- top;
		stak[++top] = b[i];
	}
	for(int r = top, l; r >= 1; r = l - 1)
	{
		l = r;
		while(l > 1 && fabs(a[stak[l-1]].fir - a[stak[l]].fir) < eps && fabs(a[stak[l-1]].sec - a[stak[l]].sec) < eps)	-- l;
		if(l == 1)	break;
		node u = a[stak[l]] - a[stak[l-1]];
		if(u.sec > -eps)
			top = l - 1;
		else
			break;
	}
	sort(stak + 1, stak + top + 1);
	for(int i = 1; i <= top; ++i)
		printf("%d ", stak[i]);
	return 0;
}


#include<cstdio>
#include<iostream>
#include<algorithm>
#include<cstring>
#include<cmath>
#include<vector>
using namespace std;
typedef pair<int, int> pii;
const int maxn = 200005;
const double eps = 1e-9;

int n, b[maxn], c[maxn], stak[maxn], top, ans[maxn], cnt;
pii p[maxn];
vector<int> G[maxn];

struct node{
	double fir, sec;
	node(){}
	node(double x, double y) {
		fir = x;
		sec = y;
	}
}a[maxn];

node operator - (node x, node y)
{
	return node(x.fir - y.fir, x.sec - y.sec);
}

double slop(node x)
{
	return x.sec / x.fir;
}

bool cmp(int x, int y)
{
	return a[x].fir < a[y].fir;
}

bool cmp1(int x, int y)
{
	return p[x].first != p[y].first? p[x].first < p[y].first: p[x].second < p[y].second;
}

int main()
{
	scanf("%d", &n);
	for(int i = 1; i <= n; ++i)
	{
		scanf("%d%d", &p[i].first, &p[i].second);
		b[i] = i;
	}
	sort(b + 1, b + n + 1, cmp1);
	int m = 0;
	for(int l = 1, r; l <= n; l = r + 1)
	{
		r = l;
		while(r < n && p[b[l]] == p[b[r+1]])	++ r;
		if(r < n && p[b[r]].first == p[b[r+1]].first)	continue;
		++ m;
		c[m] = m;
		a[m] = node(1.0 / p[b[l]].first, 1.0 / p[b[l]].second);
		for(int j = l; j <= r; ++j)
			G[m].push_back(b[j]);
	}
	sort(c + 1, c + m + 1, cmp);
	for(int i = 1; i <= m; ++i)
	{
		while(top > 1 && slop(a[stak[top]] - a[stak[top-1]]) > slop(a[c[i]] - a[stak[top-1]]))	-- top;
		stak[++top] = c[i];
	}
	for(int i = 0; i < G[stak[1]].size(); ++i)
		ans[++cnt] = G[stak[1]][i];
	for(int i = 2; i <= top; ++i)
	{
		node u = a[stak[i]] - a[stak[i-1]];
		if(slop(u) < 0)
		{
			for(int j = 0; j < G[stak[i]].size(); ++j)
				ans[++cnt] = G[stak[i]][j];
		}
		else
		{
			break;
		}
	}
	sort(ans + 1, ans + cnt + 1);
	for(int i = 1; i <= cnt; ++i)
		printf("%d ", ans[i]);
	return 0;
}


#include <list>
#include <map>
#include <set>
#include <algorithm>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <memory.h>
#include <ctime>
#include <bitset>
#include <vector>
#include <string>

using namespace std;

#define ABS(a) (((a) > 0)? (a): -(a))
#define MIN(a, b) (((a) < (b))? (a): (b))
#define MAX(a, b) (((a) < (b))? (b): (a))
#define MFOR(i, a, n) for (int i = (a); i < (n); i++)
#define FOR(i, a, n) for (int i = (a); i <= (n); i++)
#define DFOR(i, a, n) for (int i = (a); i >= (n); i--)
#define SORT(a, first_element, last_element) sort(&(a)[(first_element)], &(a)[(last_element) + 1])
#define SQR(a) (a) * (a)
#define PI 3.14159265358979323846264
#define MEMS(a, b) memset((a), (b), sizeof(a))
#define MP make_pair
#define PB push_back
#define endl '\n'
#define LL long long
#define UN unsigned
#define Or ||
#define And &&
/////////////////////////////////////////////

int bld[100050], tt[100050], rr[100050], up[100050];

void solution()
{
	int T;
	cin >> T;
	MEMS(bld, 0);
	MEMS(up, 0);
	while (T--)
	{
		int m, k, frnd = 0;
		scanf("%d%d", &m, &k);

		FOR(i, 1, k)
			scanf("%d", &bld[i]);

		int rnd = 0;
		int mn = 1000000050;

		FOR(i, 2, m)
		{
			scanf("%d%d", &tt[i], &rr[i]);
			up[tt[i]]++;
		}

		FOR(i, 2, m)
		{
			int t = tt[i], r = rr[i];
			char gg = 1;
			up[t]--;

			if (t And r)
			{
				if (gg)
				{
					FOR(j, 1, k)
					{
						if (j != t And up[j] == 0)
							mn = MIN(mn, bld[j]);
						if (bld[j] <= rnd And j != t And up[j] == 0)
							bld[j] = 0;
					}
					rnd -= MAX(0, mn);
				}

				bld[t]--;
				gg = 0;
			}
			else if (t)
			{
				bld[t]--;
			}
			else if (r)
			{
				if (gg)
				{
					FOR(j, 1, k)
					{
						if (up[j] == 0)
							mn = MIN(bld[j], mn);
						if (bld[j] <= rnd And up[j] == 0)
							bld[j] = 0;
					}
					rnd -= MAX(0, mn);
				}
				rnd++;
				gg = 0;
			}
			else
			{
				rnd++;
			}
		}

		FOR(i, 1, k)
		{
			if (rnd >= bld[i])
				printf("Y");
			else
				printf("N");
		}

		printf("\n");
	}
}

/*-------------------*/

int main()
{
#ifdef Files
freopen("input.txt", "r", stdin);
//freopen("output.txt", "w", stdout);
/*Test*/
//freopen("input.txt", "w", stdout);

double OcZ2X = clock();
#else
//freopen("tree.in", "r", stdin);
//freopen("tree.out", "w", stdout);
#endif

solution();

#ifdef Time
double P2HxQ = clock();
printf("\n*** Total time = %.3f sec ***\n", (P2HxQ - OcZ2X) / CLOCKS_PER_SEC);
#endif
}


#include <list>
#include <map>
#include <set>
#include <algorithm>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <memory.h>
#include <ctime>
#include <bitset>
#include <vector>
#include <string>

using namespace std;

#define ABS(a) (((a) > 0)? (a): -(a))
#define MIN(a, b) (((a) < (b))? (a): (b))
#define MAX(a, b) (((a) < (b))? (b): (a))
#define MFOR(i, a, n) for (int i = (a); i < (n); i++)
#define FOR(i, a, n) for (int i = (a); i <= (n); i++)
#define DFOR(i, a, n) for (int i = (a); i >= (n); i--)
#define SORT(a, first_element, last_element) sort(&(a)[(first_element)], &(a)[(last_element) + 1])
#define SQR(a) (a) * (a)
#define PI 3.14159265358979323846264
#define MEMS(a, b) memset((a), (b), sizeof(a))
#define MP make_pair
#define PB push_back
#define endl '\n'
#define LL long long
#define UN unsigned
#define Or ||
#define And &&
/////////////////////////////////////////////

int bld[100050];

void solution()
{
	int T;
	cin >> T;
	MEMS(bld, 0);
	while (T--)
	{
		int m, k, frnd = 0;
		scanf("%d%d", &m, &k);
		int mn = 1;

		FOR(i, 1, k)
		{
			scanf("%d", &bld[i]);
			if (bld[i] < bld[mn])
				mn = i;
		}

		int rnd = 0, mnps = 0;
		char r1 = 0;

		FOR(i, 2, m)
		{
			int t, r;
			scanf("%d%d", &t, &r);
			char gg = 1;
			int ff = 0;

			if (t And r)
			{
				if (gg)
				{
					FOR(j, 1, k)
					{
						if (bld[j] <= rnd)
							bld[j] = 0;
					}
				}
				rnd = 0;
				bld[t]--;

			}
			else if (t)
			{
				bld[t]--;
				if (bld[t] < bld[mn])
					mn = t;
			}
			else if (r)
			{
				rnd++;
				if (gg)
				{
					FOR(j, 1, k)
					{
						if (bld[j] <= rnd)
							bld[j] = 0;
					}
					rnd = 0;
				}

				gg = 0;
			}
			else
			{
				rnd++;
			}
		}
		rnd = MAX(rnd, 0);
		FOR(i, 1, k)
		{
			if (rnd >= bld[i])
				printf("Y");
			else
				printf("N");
			bld[i] = 0;
		}

		printf("\n");
	}
}

/*-------------------*/

int main()
{
#ifdef Files
freopen("input.txt", "r", stdin);
//freopen("output.txt", "w", stdout);
/*Test*/
//freopen("input.txt", "w", stdout);

double OcZ2X = clock();
#else
//freopen("tree.in", "r", stdin);
//freopen("tree.out", "w", stdout);
#endif

solution();

#ifdef Time
double P2HxQ = clock();
printf("\n*** Total time = %.3f sec ***\n", (P2HxQ - OcZ2X) / CLOCKS_PER_SEC);
#endif
}


#include <list>
#include <map>
#include <set>
#include <algorithm>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <memory.h>
#include <ctime>
#include <bitset>
#include <vector>
#include <string>

using namespace std;

#define ABS(a) (((a) > 0)? (a): -(a))
#define MIN(a, b) (((a) < (b))? (a): (b))
#define MAX(a, b) (((a) < (b))? (b): (a))
#define MFOR(i, a, n) for (int i = (a); i < (n); i++)
#define FOR(i, a, n) for (int i = (a); i <= (n); i++)
#define DFOR(i, a, n) for (int i = (a); i >= (n); i--)
#define SORT(a, first_element, last_element) sort(&(a)[(first_element)], &(a)[(last_element) + 1])
#define SQR(a) (a) * (a)
#define PI 3.14159265358979323846264
#define MEMS(a, b) memset((a), (b), sizeof(a))
#define MP make_pair
#define PB push_back
#define endl '\n'
#define LL long long
#define UN unsigned
#define Or ||
#define And &&
/////////////////////////////////////////////

int bld[100050];

void solution()
{
	int T;
	cin >> T;
	MEMS(bld, 0);
	while (T--)
	{
		int m, k, frnd = 0;
		scanf("%d%d", &m, &k);
		int mn = 1000000000;
		FOR(i, 1, k)
			scanf("%d", &bld[i]);

		int rnd = 0;

		FOR(i, 2, m)
		{
			int t, r;
			scanf("%d%d", &t, &r);
			if (t != 0)
				bld[t]--;
			else
			{
				rnd++;
				if (r)
				{
					if (frnd == 0)
						frnd = rnd;
				}
			}
		}
		FOR(i, 1, k)
			mn = MIN(mn, bld[i]);
		if (frnd)
			rnd -= mn;
		frnd--;
		FOR(i, 1, k)
		{
			if (rnd >= bld[i] Or frnd >= bld[i])
				printf("Y");
			else
				printf("N");
			bld[i] = 0;
		}
		printf("\n");
	}
}

/*-------------------*/

int main()
{
#ifdef Files
freopen("input.txt", "r", stdin);
//freopen("output.txt", "w", stdout);
/*Test*/
//freopen("input.txt", "w", stdout);

double OcZ2X = clock();
#else
//freopen("tree.in", "r", stdin);
//freopen("tree.out", "w", stdout);
#endif

solution();

#ifdef Time
double P2HxQ = clock();
printf("\n*** Total time = %.3f sec ***\n", (P2HxQ - OcZ2X) / CLOCKS_PER_SEC);
#endif
}


#include <list>
#include <map>
#include <set>
#include <algorithm>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <memory.h>
#include <ctime>
#include <bitset>
#include <vector>
#include <string>

using namespace std;

#define ABS(a) (((a) > 0)? (a): -(a))
#define MIN(a, b) (((a) < (b))? (a): (b))
#define MAX(a, b) (((a) < (b))? (b): (a))
#define MFOR(i, a, n) for (int i = (a); i < (n); i++)
#define FOR(i, a, n) for (int i = (a); i <= (n); i++)
#define DFOR(i, a, n) for (int i = (a); i >= (n); i--)
#define SORT(a, first_element, last_element) sort(&(a)[(first_element)], &(a)[(last_element) + 1])
#define SQR(a) (a) * (a)
#define PI 3.14159265358979323846264
#define MEMS(a, b) memset((a), (b), sizeof(a))
#define MP make_pair
#define PB push_back
#define endl '\n'
#define LL long long
#define UN unsigned
#define Or ||
#define And &&
/////////////////////////////////////////////

int bld[100050];
char ans[100050];

void solution()
{
	int T;
	cin >> T;
	MEMS(bld, 0);
	while (T--)
	{
		int m, k, frnd = 0;
		scanf("%d%d", &m, &k);
		int mn = 1;
		MEMS(ans, 0);

		FOR(i, 1, k)
		{
			scanf("%d", &bld[i]);
			if (bld[i] < bld[mn])
				mn = i;
		}

		int rnd = 0, mnps = 0;
		char r1 = 0;

		FOR(i, 2, m)
		{
			int t, r;
			scanf("%d%d", &t, &r);
			char gg = 1;
			int ff = 0;

			if (t And r)
			{
				if (mn == t And gg)
				{
					if (mn == 1)
						mn = 2;
					else
						mn = 1;
					FOR(j, 1, k)
					{
						if (bld[j] < bld[mn] And j != t)
							mn = j;
					}
				}
				rnd -= MAX(0, bld[mn] - 1);
				if (bld[mn] == 0)
					bld[t]--;
				bld[mn] = 0;
				gg = 0;
			}
			else if (t)
			{
				bld[t]--;
				if (bld[t] < bld[mn])
					mn = t;
			}
			else if (r)
			{
				rnd++;
				if (gg)
				{
					FOR(j, 1, k)
					{
						if (bld[j] <= rnd)
							ans[j] = 1;
					}
					rnd = 0;
				}

				gg = 0;
			}
			else
			{
				rnd++;
			}
		}
		FOR(i, 1, k)
		{
			if (rnd >= bld[i] Or ans[i])
				printf("Y");
			else
				printf("N");
			bld[i] = 0;
			ans[i] = 0;
		}

		printf("\n");
	}
}

/*-------------------*/

int main()
{
#ifdef Files
freopen("input.txt", "r", stdin);
//freopen("output.txt", "w", stdout);
/*Test*/
//freopen("input.txt", "w", stdout);

double OcZ2X = clock();
#else
//freopen("tree.in", "r", stdin);
//freopen("tree.out", "w", stdout);
#endif

solution();

#ifdef Time
double P2HxQ = clock();
printf("\n*** Total time = %.3f sec ***\n", (P2HxQ - OcZ2X) / CLOCKS_PER_SEC);
#endif
}


#include <list>
#include <map>
#include <set>
#include <algorithm>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <memory.h>
#include <ctime>
#include <bitset>
#include <vector>
#include <string>

using namespace std;

#define ABS(a) (((a) > 0)? (a): -(a))
#define MIN(a, b) (((a) < (b))? (a): (b))
#define MAX(a, b) (((a) < (b))? (b): (a))
#define MFOR(i, a, n) for (int i = (a); i < (n); i++)
#define FOR(i, a, n) for (int i = (a); i <= (n); i++)
#define DFOR(i, a, n) for (int i = (a); i >= (n); i--)
#define SORT(a, first_element, last_element) sort(&(a)[(first_element)], &(a)[(last_element) + 1])
#define SQR(a) (a) * (a)
#define PI 3.14159265358979323846264
#define MEMS(a, b) memset((a), (b), sizeof(a))
#define MP make_pair
#define PB push_back
#define endl '\n'
#define LL long long
#define UN unsigned
#define Or ||
#define And &&
/////////////////////////////////////////////

int bld[100050];

void solution()
{
	int T;
	cin >> T;
	MEMS(bld, 0);
	while (T--)
	{
		int m, k, frnd = 0;
		scanf("%d%d", &m, &k);

		FOR(i, 1, k)
			scanf("%d", &bld[i]);

		int rnd = 0, mnps = 0;
		char r1 = 0;
		int mn = 1000000050;

		FOR(i, 2, m)
		{
			int t, r;
			scanf("%d%d", &t, &r);
			char gg = 1;
			int ff = 0;

			if (t And r)
			{
				if (gg)
				{
					FOR(j, 1, k)
					{
						if (j != t)
							mn = MIN(mn, bld[j]);
						if (bld[j] <= rnd And j != t)
							bld[j] = 0;
					}
				}
				rnd -= mn;
				bld[t]--;
				gg = 0;
				mn = 0;
			}
			else if (t)
			{
				bld[t]--;
			}
			else if (r)
			{
				rnd++;
				if (gg)
				{
					FOR(j, 1, k)
					{
						if (bld[j] <= mn)
							mn = bld[j];
						if (bld[j] <= rnd)
							bld[j] = 0;
					}
					rnd -= MAX(mn - 1, 0);
				}

				gg = 0;
			}
			else
			{
				rnd++;
			}
		}
		rnd = MAX(rnd, 0);
		FOR(i, 1, k)
		{
			if (rnd >= bld[i])
				printf("Y");
			else
				printf("N");
			bld[i] = 0;
		}

		printf("\n");
	}
}

/*-------------------*/

int main()
{
#ifdef Files
freopen("input.txt", "r", stdin);
//freopen("output.txt", "w", stdout);
/*Test*/
//freopen("input.txt", "w", stdout);

double OcZ2X = clock();
#else
//freopen("tree.in", "r", stdin);
//freopen("tree.out", "w", stdout);
#endif

solution();

#ifdef Time
double P2HxQ = clock();
printf("\n*** Total time = %.3f sec ***\n", (P2HxQ - OcZ2X) / CLOCKS_PER_SEC);
#endif
}


#include <list>
#include <map>
#include <set>
#include <algorithm>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <memory.h>
#include <ctime>
#include <bitset>
#include <vector>
#include <string>

using namespace std;

#define ABS(a) (((a) > 0)? (a): -(a))
#define MIN(a, b) (((a) < (b))? (a): (b))
#define MAX(a, b) (((a) < (b))? (b): (a))
#define MFOR(i, a, n) for (int i = (a); i < (n); i++)
#define FOR(i, a, n) for (int i = (a); i <= (n); i++)
#define DFOR(i, a, n) for (int i = (a); i >= (n); i--)
#define SORT(a, first_element, last_element) sort(&(a)[(first_element)], &(a)[(last_element) + 1])
#define SQR(a) (a) * (a)
#define PI 3.14159265358979323846264
#define MEMS(a, b) memset((a), (b), sizeof(a))
#define MP make_pair
#define PB push_back
#define endl '\n'
#define LL long long
#define UN unsigned
#define Or ||
#define And &&
/////////////////////////////////////////////

int bld[100050];

void solution()
{
	int T;
	cin >> T;
	MEMS(bld, 0);
	while (T--)
	{
		int m, k, frnd = 0;
		scanf("%d%d", &m, &k);
		int mn = 1;

		FOR(i, 1, k)
		{
			scanf("%d", &bld[i]);
			if (bld[i] < bld[mn])
				mn = i;
		}

		int rnd = 0, mnps = 0;
		char r1 = 0;

		FOR(i, 2, m)
		{
			int t, r;
			scanf("%d%d", &t, &r);
			char gg = 1;
			int ff = 0;

			if (t And r)
			{
				bld[t]--;
				if (gg)
				{
					FOR(j, 1, k)
					{
						if (bld[j] <= rnd)
							bld[j] = 0;
					}
				}
				rnd = 0;

			}
			else if (t)
			{
				bld[t]--;
				if (bld[t] < bld[mn])
					mn = t;
			}
			else if (r)
			{
				rnd++;
				if (gg)
				{
					FOR(j, 1, k)
					{
						if (bld[j] <= rnd)
							bld[j] = 0;
					}
					rnd = 0;
				}

				gg = 0;
			}
			else
			{
				rnd++;
			}
		}
		rnd = MAX(rnd, 0);
		FOR(i, 1, k)
		{
			if (rnd >= bld[i])
				printf("Y");
			else
				printf("N");
			bld[i] = 0;
		}

		printf("\n");
	}
}

/*-------------------*/

int main()
{
#ifdef Files
freopen("input.txt", "r", stdin);
//freopen("output.txt", "w", stdout);
/*Test*/
//freopen("input.txt", "w", stdout);

double OcZ2X = clock();
#else
//freopen("tree.in", "r", stdin);
//freopen("tree.out", "w", stdout);
#endif

solution();

#ifdef Time
double P2HxQ = clock();
printf("\n*** Total time = %.3f sec ***\n", (P2HxQ - OcZ2X) / CLOCKS_PER_SEC);
#endif
}


#include <list>
#include <map>
#include <set>
#include <algorithm>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <memory.h>
#include <ctime>
#include <bitset>
#include <vector>
#include <string>

using namespace std;

#define ABS(a) (((a) > 0)? (a): -(a))
#define MIN(a, b) (((a) < (b))? (a): (b))
#define MAX(a, b) (((a) < (b))? (b): (a))
#define MFOR(i, a, n) for (int i = (a); i < (n); i++)
#define FOR(i, a, n) for (int i = (a); i <= (n); i++)
#define DFOR(i, a, n) for (int i = (a); i >= (n); i--)
#define SORT(a, first_element, last_element) sort(&(a)[(first_element)], &(a)[(last_element) + 1])
#define SQR(a) (a) * (a)
#define PI 3.14159265358979323846264
#define MEMS(a, b) memset((a), (b), sizeof(a))
#define MP make_pair
#define PB push_back
#define endl '\n'
#define LL long long
#define UN unsigned
#define Or ||
#define And &&
/////////////////////////////////////////////

int bld[100050];

void solution()
{
	int T;
	cin >> T;
	MEMS(bld, 0);
	while (T--)
	{
		int m, k, frnd = 0;
		scanf("%d%d", &m, &k);

		FOR(i, 1, k)
			scanf("%d", &bld[i]);

		int rnd = 0, mnps = 0;
		char r1 = 0;
		int mn = 1000000050;

		FOR(i, 2, m)
		{
			int t, r;
			scanf("%d%d", &t, &r);
			char gg = 1;
			int ff = 0;

			if (t And r)
			{
				if (gg)
				{
					FOR(j, 1, k)
					{
						if (j != t)
							mn = MIN(mn, bld[j]);
						if (bld[j] <= rnd And j != t)
							bld[j] = 0;
					}
				}
				rnd -= mn;
				bld[t]--;
				gg = 0;
				mn = 0;
			}
			else if (t)
			{
				bld[t]--;
			}
			else if (r)
			{
				rnd++;
				if (gg)
				{
					FOR(j, 1, k)
					{
						if (bld[j] <= rnd)
							bld[j] = 0;
					}
					rnd = 0;
				}

				gg = 0;
			}
			else
			{
				rnd++;
			}
		}
		rnd = MAX(rnd, 0);
		FOR(i, 1, k)
		{
			if (rnd >= bld[i])
				printf("Y");
			else
				printf("N");
			bld[i] = 0;
		}

		printf("\n");
	}
}

/*-------------------*/

int main()
{
#ifdef Files
freopen("input.txt", "r", stdin);
//freopen("output.txt", "w", stdout);
/*Test*/
//freopen("input.txt", "w", stdout);

double OcZ2X = clock();
#else
//freopen("tree.in", "r", stdin);
//freopen("tree.out", "w", stdout);
#endif

solution();

#ifdef Time
double P2HxQ = clock();
printf("\n*** Total time = %.3f sec ***\n", (P2HxQ - OcZ2X) / CLOCKS_PER_SEC);
#endif
}


#include <list>
#include <map>
#include <set>
#include <algorithm>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <memory.h>
#include <ctime>
#include <bitset>
#include <vector>
#include <string>

using namespace std;

#define ABS(a) (((a) > 0)? (a): -(a))
#define MIN(a, b) (((a) < (b))? (a): (b))
#define MAX(a, b) (((a) < (b))? (b): (a))
#define MFOR(i, a, n) for (int i = (a); i < (n); i++)
#define FOR(i, a, n) for (int i = (a); i <= (n); i++)
#define DFOR(i, a, n) for (int i = (a); i >= (n); i--)
#define SORT(a, first_element, last_element) sort(&(a)[(first_element)], &(a)[(last_element) + 1])
#define SQR(a) (a) * (a)
#define PI 3.14159265358979323846264
#define MEMS(a, b) memset((a), (b), sizeof(a))
#define MP make_pair
#define PB push_back
#define endl '\n'
#define LL long long
#define UN unsigned
#define Or ||
#define And &&
/////////////////////////////////////////////

int bld[100050], tt[100050], rr[100050], up[100050];

void solution()
{
	int T;
	cin >> T;
	MEMS(bld, 0);
	MEMS(up, 0);
	while (T--)
	{
		int m, k, frnd = 0;
		scanf("%d%d", &m, &k);

		FOR(i, 1, k)
			scanf("%d", &bld[i]);

		int rnd = 0;
		int mn = 1000000050;

		FOR(i, 2, m)
		{
			scanf("%d%d", &tt[i], &rr[i]);
			up[tt[i]]++;
		}

		FOR(i, 2, m)
		{
			int t = tt[i], r = rr[i];
			char gg = 1;
			up[t]--;

			if (t And r)
			{
				if (gg)
				{
					FOR(j, 1, t - 1)
					{
						if (up[j] == 0 And bld[j] < mn)
							mn = bld[j];
						if (bld[j] <= rnd And up[j] == 0)
							bld[j] = 0;
					}

					FOR(j, t + 1, k)
					{
						if (up[j] == 0 And bld[j] < mn)
							mn = bld[j];
						if (bld[j] <= rnd And up[j] == 0)
							bld[j] = 0;
					}
					rnd -= MAX(0, mn);
				}

				bld[t]--;
				gg = 0;
			}
			else if (t)
			{
				bld[t]--;
			}
			else if (r)
			{
				if (gg)
				{
					FOR(j, 1, k)
					{
						if (up[j] == 0 And bld[j] < mn)
							mn = bld[j];
						if (bld[j] <= rnd And up[j] == 0)
							bld[j] = 0;
					}
					rnd -= MAX(0, mn);
				}
				rnd++;
				gg = 0;
			}
			else
			{
				rnd++;
			}
		}

		FOR(i, 1, k)
		{
			if (rnd >= bld[i])
				printf("Y");
			else
				printf("N");
		}

		printf("\n");
	}
}

/*-------------------*/

int main()
{
#ifdef Files
freopen("input.txt", "r", stdin);
//freopen("output.txt", "w", stdout);
/*Test*/
//freopen("input.txt", "w", stdout);

double OcZ2X = clock();
#else
//freopen("tree.in", "r", stdin);
//freopen("tree.out", "w", stdout);
#endif

solution();

#ifdef Time
double P2HxQ = clock();
printf("\n*** Total time = %.3f sec ***\n", (P2HxQ - OcZ2X) / CLOCKS_PER_SEC);
#endif
}


#include <list>
#include <map>
#include <set>
#include <algorithm>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <memory.h>
#include <ctime>
#include <bitset>
#include <vector>
#include <string>

using namespace std;

#define ABS(a) (((a) > 0)? (a): -(a))
#define MIN(a, b) (((a) < (b))? (a): (b))
#define MAX(a, b) (((a) < (b))? (b): (a))
#define MFOR(i, a, n) for (int i = (a); i < (n); i++)
#define FOR(i, a, n) for (int i = (a); i <= (n); i++)
#define DFOR(i, a, n) for (int i = (a); i >= (n); i--)
#define SORT(a, first_element, last_element) sort(&(a)[(first_element)], &(a)[(last_element) + 1])
#define SQR(a) (a) * (a)
#define PI 3.14159265358979323846264
#define MEMS(a, b) memset((a), (b), sizeof(a))
#define MP make_pair
#define PB push_back
#define endl '\n'
#define LL long long
#define UN unsigned
#define Or ||
#define And &&
/////////////////////////////////////////////

int bld[100050];

void solution()
{
	int T;
	cin >> T;
	MEMS(bld, 0);
	while (T--)
	{
		int m, k, frnd = 0;
		scanf("%d%d", &m, &k);

		FOR(i, 1, k)
			scanf("%d", &bld[i]);

		int rnd = 0, mnps = 0;
		char r1 = 0;
		int mn = 1000000050;

		FOR(i, 2, m)
		{
			int t, r;
			scanf("%d%d", &t, &r);
			char gg = 1;
			int ff = 0;

			if (t And r)
			{
				if (gg)
				{
					FOR(j, 1, k)
					{
						if (j != t)
							mn = MIN(mn, bld[j]);
						if (bld[j] <= rnd And j != t)
							bld[j] = 0;
					}
					rnd -= mn;
				}
				bld[t]--;
				gg = 0;
			}
			else if (t)
			{
				bld[t]--;
			}
			else if (r)
			{
				rnd++;
				if (gg)
				{
					FOR(j, 1, k)
					{
						if (bld[j] <= mn)
							mn = bld[j];
						if (bld[j] <= rnd)
							bld[j] = 0;
					}
					rnd -= mn;
				}

				gg = 0;
			}
			else
			{
				rnd++;
			}
		}
		rnd = MAX(rnd, 0);
		FOR(i, 1, k)
		{
			if (rnd >= bld[i])
				printf("Y");
			else
				printf("N");
			bld[i] = 0;
		}

		printf("\n");
	}
}

/*-------------------*/

int main()
{
#ifdef Files
freopen("input.txt", "r", stdin);
//freopen("output.txt", "w", stdout);
/*Test*/
//freopen("input.txt", "w", stdout);

double OcZ2X = clock();
#else
//freopen("tree.in", "r", stdin);
//freopen("tree.out", "w", stdout);
#endif

solution();

#ifdef Time
double P2HxQ = clock();
printf("\n*** Total time = %.3f sec ***\n", (P2HxQ - OcZ2X) / CLOCKS_PER_SEC);
#endif
}


#include <list>
#include <map>
#include <set>
#include <algorithm>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <memory.h>
#include <ctime>
#include <bitset>
#include <vector>
#include <string>

using namespace std;

#define ABS(a) (((a) > 0)? (a): -(a))
#define MIN(a, b) (((a) < (b))? (a): (b))
#define MAX(a, b) (((a) < (b))? (b): (a))
#define MFOR(i, a, n) for (int i = (a); i < (n); i++)
#define FOR(i, a, n) for (int i = (a); i <= (n); i++)
#define DFOR(i, a, n) for (int i = (a); i >= (n); i--)
#define SORT(a, first_element, last_element) sort(&(a)[(first_element)], &(a)[(last_element) + 1])
#define SQR(a) (a) * (a)
#define PI 3.14159265358979323846264
#define MEMS(a, b) memset((a), (b), sizeof(a))
#define MP make_pair
#define PB push_back
#define endl '\n'
#define LL long long
#define UN unsigned
#define Or ||
#define And &&
/////////////////////////////////////////////

int bld[100050], tt[100050], rr[100050], up[100050];

void solution()
{
	int T;
	cin >> T;
	MEMS(bld, 0);
	MEMS(up, 0);
	while (T--)
	{
		int m, k, frnd = 0;
		scanf("%d%d", &m, &k);

		FOR(i, 1, k)
			scanf("%d", &bld[i]);

		int rnd = 0;
		int mn = 1000000050;

		FOR(i, 2, m)
		{
			scanf("%d%d", &tt[i], &rr[i]);
			up[tt[i]]++;
		}

		FOR(i, 2, m)
		{
			int t = tt[i], r = rr[i];
			char gg = 1;
			up[t]--;

			if (t And r)
			{
				if (gg)
				{
					FOR(j, 1, k)
					{
						if (j != t)
							mn = MIN(mn, bld[j]);
						if (bld[j] <= rnd And j != t And up[j] == 0)
							bld[j] = 0;
					}
					rnd -= MAX(0, mn);
				}

				bld[t]--;
				gg = 0;
			}
			else if (t)
			{
				bld[t]--;
			}
			else if (r)
			{
				if (gg)
				{
					FOR(j, 1, k)
					{
						if (bld[j] <= mn)
							mn = bld[j];
						if (bld[j] <= rnd And up[j] == 0)
							bld[j] = 0;
					}
					rnd -= MAX(0, mn);
				}
				rnd++;
				gg = 0;
			}
			else
			{
				rnd++;
			}
		}

		FOR(i, 1, k)
		{
			if (rnd >= bld[i])
				printf("Y");
			else
				printf("N");
			up[i] = 0;
		}

		printf("\n");
	}
}

/*-------------------*/

int main()
{
#ifdef Files
freopen("input.txt", "r", stdin);
//freopen("output.txt", "w", stdout);
/*Test*/
//freopen("input.txt", "w", stdout);

double OcZ2X = clock();
#else
//freopen("tree.in", "r", stdin);
//freopen("tree.out", "w", stdout);
#endif

solution();

#ifdef Time
double P2HxQ = clock();
printf("\n*** Total time = %.3f sec ***\n", (P2HxQ - OcZ2X) / CLOCKS_PER_SEC);
#endif
}


#include <list>
#include <map>
#include <set>
#include <algorithm>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <memory.h>
#include <ctime>
#include <bitset>
#include <vector>
#include <string>

using namespace std;

#define ABS(a) (((a) > 0)? (a): -(a))
#define MIN(a, b) (((a) < (b))? (a): (b))
#define MAX(a, b) (((a) < (b))? (b): (a))
#define MFOR(i, a, n) for (int i = (a); i < (n); i++)
#define FOR(i, a, n) for (int i = (a); i <= (n); i++)
#define DFOR(i, a, n) for (int i = (a); i >= (n); i--)
#define SORT(a, first_element, last_element) sort(&(a)[(first_element)], &(a)[(last_element) + 1])
#define SQR(a) (a) * (a)
#define PI 3.14159265358979323846264
#define MEMS(a, b) memset((a), (b), sizeof(a))
#define MP make_pair
#define PB push_back
#define endl '\n'
#define LL long long
#define UN unsigned
#define Or ||
#define And &&
/////////////////////////////////////////////

int bld[100050];

void solution()
{
	int T;
	cin >> T;
	MEMS(bld, 0);
	while (T--)
	{
		int m, k, frnd = 0;
		scanf("%d%d", &m, &k);

		FOR(i, 1, k)
			scanf("%d", &bld[i]);

		int rnd = 0, mnps = 0;
		char r1 = 0;
		int mn = 1000000050;

		FOR(i, 2, m)
		{
			int t, r;
			scanf("%d%d", &t, &r);
			char gg = 1;
			int ff = 0;

			if (t And r)
			{
				if (gg)
				{
					FOR(j, 1, k)
					{
						if (j != t)
							mn = MIN(mn, bld[j]);
						if (bld[j] <= rnd And j != t)
							bld[j] = 0;
					}
					rnd -= MAX(mn - 1, 0);
				}
				gg = 0;
			}
			else if (t)
			{
				bld[t]--;
			}
			else if (r)
			{
				rnd++;
				if (gg)
				{
					FOR(j, 1, k)
					{
						if (bld[j] <= mn)
							mn = bld[j];
						if (bld[j] <= rnd)
							bld[j] = 0;
					}
					rnd -= mn;
				}

				gg = 0;
			}
			else
			{
				rnd++;
			}
		}
		rnd = MAX(rnd, 0);
		FOR(i, 1, k)
		{
			if (rnd >= bld[i])
				printf("Y");
			else
				printf("N");
			bld[i] = 0;
		}

		printf("\n");
	}
}

/*-------------------*/

int main()
{
#ifdef Files
freopen("input.txt", "r", stdin);
//freopen("output.txt", "w", stdout);
/*Test*/
//freopen("input.txt", "w", stdout);

double OcZ2X = clock();
#else
//freopen("tree.in", "r", stdin);
//freopen("tree.out", "w", stdout);
#endif

solution();

#ifdef Time
double P2HxQ = clock();
printf("\n*** Total time = %.3f sec ***\n", (P2HxQ - OcZ2X) / CLOCKS_PER_SEC);
#endif
}


#if 1
#include<cstdio>
#include<cstdlib>
#include<iostream>
#include<algorithm>
#include<set>
#include<map>
#include<queue>
#include<vector>
#include<cstring>
#include<string>
#include<cmath>
#include<ctime>

using namespace std;

typedef unsigned long long li;
typedef long double ld;
typedef double dd;
typedef vector<int> vi;
typedef pair<int, int> pii;

#define X first
#define Y second
#define file "file"
#define mp make_pair
#define pb push_back

int main()
{
#ifdef _DEBUG
//    freopen("input.txt", "r", stdin);
#endif
    int T;
    cin>>T;
    while(T-->0)
    {
        int m,k;
        cin>>m>>k;
        m--;
        vector<int>b(k), bNext(k), used(k,0);
        vector<pii>chel(m);
        int flag = 0;
        for(int i=0;i<k;i++)
        {
            cin>>b[i];
        }
        for(int i=0;i<m;i++)
        {
            cin>>chel[i].X>>chel[i].Y;
            if(chel[i].X > 0)
                bNext[chel[i].X - 1]++;
        }
        int neopr = 0;
        for(int i=0;i<m;i++)
        {
            if(chel[i].Y==1 && flag == 0)
            {
                flag = 1;
                int mi = 100500;
                int ind = 0;
                for(int j=0;j<k;j++)
                {
                    if(bNext[j])
                        continue;
                    if(b[j] <= neopr)
                        used[j] = 1;
                    if(b[j] < mi)
                    {
                        mi = b[j];
                        ind = j;
                    }
                }
                neopr -= mi;
            }
            if(chel[i].X == 0)
                neopr++;
            else
            {
                b[chel[i].X - 1]--;
                bNext[chel[i].X - 1]--;
            }
        }
        for(int i=0;i<k;i++)
        {
            if(used[i]==1)
            {
                cout<<'Y';
                continue;
            }
            if(b[i] - neopr <= 0)
            {
                cout << 'Y';
                continue;
            }
            cout<<'N';
        }
        cout<<endl;
    }
    return 0;
}
#endif