#pragma GCC optimize("fast-math,Ofast,unroll-loops")
#include <map>
#include <set>
#include <array>
#include <cmath>
#include <deque>
#include <bitset>
#include <random>
#include <string>
#include <vector>
#include <cassert>
#include <complex>
#include <iomanip>
#include <iostream>
#include <algorithm>
#include <unordered_map>
#include <unordered_set>
using namespace std;
#define int int64_t
using ld = long double;
ld abs(ld x) {
if (x > 0) return x;
return -x;
}
struct IVector {
int x;
int y;
IVector(int x = 0, int y = 0): x(x), y(y) {}
IVector(const IVector& a, const IVector& b): x(b.x - a.x), y(b.y - a.y) {}
};
IVector operator-(const IVector& a) {
return {-a.x, -a.y};
}
int operator%(const IVector& a, const IVector& b) {
return a.x * b.y - a.y * b.x;
}
bool hp(const IVector& v) {
if (v.y == 0) return v.x > 0;
return v.y > 0;
}
bool operator<(const IVector& a, const IVector& b) {
if (hp(a) != hp(b)) return hp(a);
return a % b > 0;
}
bool operator==(const IVector& a, const IVector& b) {
return a.x == b.x && a.y == b.y;
}
istream& operator>>(istream& in, IVector& v) {
in >> v.x >> v.y;
return in;
}
const int MAXN = 1e5 + 100;
bool is_bad[MAXN];
struct Vector {
ld x;
ld y;
Vector(ld x = 0, ld y = 0): x(x), y(y) {}
Vector(const Vector& a, const Vector& b): x(b.x - a.x), y(b.y - a.y) {}
Vector(const IVector& a): x(a.x), y(a.y) {}
Vector(const IVector& a, bool inv) {
ld ln = a.x * a.x + a.y * a.y;
x = a.x; y = a.y;
x /= ln;
y /= ln;
}
ld sqlen() const { return x * x + y * y; }
};
Vector operator-(const Vector& a, const Vector& b) {
return Vector(b, a);
}
Vector operator+(const Vector& a, const Vector& b) {
return {a.x + b.x, a.y + b.y};
}
ld operator%(const Vector& a, const Vector& b) {
return a.x * b.y - a.y * b.x;
}
ld operator*(const Vector& a, const Vector& b) {
return a.x * b.x + a.y * b.y;
}
const ld EPS = 1e-18;
const int MAXK = 10;
vector<Vector> convex(vector<Vector>& p) {
if (p.empty()) return p;
int n = p.size();
Vector minp = p[0];
for (int i = 1; i < n; ++i) {
if (p[i].x < minp.x) {
minp = p[i];
} else if (p[i].x == minp.x && p[i].y < minp.y) {
minp = p[i];
}
}
sort(p.begin(), p.end(), [&](const Vector& u, const Vector& v) {
if (abs((u - minp) % (v - minp)) < EPS) {
return (u - minp).sqlen() < (v - minp).sqlen();
}
return (u - minp) % (v - minp) < 0;
});
p.push_back(p[0]);
/**for (auto elem : p) {
cout << (double)elem.x << " " << (double)elem.y << " : ";
}
cout << endl;*/
vector<Vector> st;
int sz = 0;
vector<Vector> p1;
for (auto v : p) {
while (sz >= 2 && (st[sz - 1] - st[sz - 2]) % (v - st[sz - 1]) >= -EPS) {
p1.push_back(st.back());
st.pop_back();
--sz;
}
st.push_back(v);
++sz;
}
st.pop_back();
p = p1;
return st;
}
int norm(int x, int n) {
while (x >= n) x -= n;
return x;
}
int reduce(int x, int n) {
while (x < 0) x += n;
return x;
}
vector<Vector> get_bst(const Vector& dir, const vector<Vector>& p, int cnt) {
if (p.empty()) return p;
int n = p.size();
int k = 0;
while ((1 << k) < n) ++k;
int i = 0;
while (k >= 0) {
int i1 = norm((i + (1 << k)), n);
int i2 = reduce((i - (1 << k)), n);
if (dir * p[i1] > dir * p[i]) i = i1;
if (dir * p[i2] > dir * p[i]) i = i2;
--k;
}
vector<Vector> ans = {p[i]};
int sz = min(cnt - 1, n - 1);
int t1 = norm((i + 1) , n);
int t2 = reduce((i - 1) , n);
for (int _ = 0; _ < sz; ++_) {
if (dir * p[t1] > dir * p[t2]) {
ans.push_back(p[t1]);
t1 = norm((t1 + 1), n);
} else {
ans.push_back(p[t2]);
t2 = reduce((t2 - 1) , n);
}
}
return ans;
}
mt19937 rnd;
const int MAX = 100000000;
signed main() {
ios::sync_with_stdio(false);
cin.tie(0);
cout.tie(0);
cout << fixed << setprecision(10);
int n;
cin >> n;
vector<IVector> p(n);
int cnt0 = 0;
for (int i = 0; i < n; ++i) {
cin >> p[i];
/**p[i].x = rnd() % (2 * MAX) - MAX;
p[i].y = rnd() % (2 * MAX) - MAX;*/
}
vector<IVector> p1;
for (int i = 0; i < n; ++i) {
if (p[i] == IVector()) {
++cnt0;
} else {
p1.push_back(p[i]);
}
}
p = p1;
n = p.size();
int q;
cin >> q;
vector<pair<IVector, int>> qu(q);
for (int i = 0; i < q; ++i) {
cin >> qu[i].first >> qu[i].second;
/**qu[i].first.x = rnd() % (2 * MAX) - MAX;
qu[i].first.y = rnd() % (2 * MAX) - MAX;
qu[i].second = 5;*/
qu[i].second -= cnt0;
}
int cnt = 0;
for (int i = 0; i < n; ++i) {
if (hp(p[i])) ++cnt;
}
vector<pair<IVector, int>> ev;
for (int i = 0; i < n; ++i) {
ev.push_back({p[i], -1});
ev.push_back({-p[i], q});
}
for (int i = 0; i < q; ++i) {
if (qu[i].first == IVector()) {
is_bad[i] = true;
continue;
}
ev.push_back({{qu[i].first.y, -qu[i].first.x}, i});
}
sort(ev.begin(), ev.end());
for (auto elem : ev) {
if (elem.second == -1) {
--cnt;
} else if (elem.second == q) {
++cnt;
} else {
if (cnt < qu[elem.second].second) {
is_bad[elem.second] = true;
}
}
}
vector<Vector> pv;
for (int i = 0; i < n; ++i) {
pv.push_back(Vector(p[i], true));
/// cerr << i << ": " << (double)pv[i].x << " " << (double)pv[i].y << endl;
}
vector<vector<Vector>> hulls;
for (int i = 0; i < MAXK; ++i) {
hulls.push_back(convex(pv));
/**for (Vector v : hulls.back()) {
cout << (double)v.x << " " << (double)v.y << "; ";
}
cout << endl;*/
}
for (int i = 0; i < q; ++i) {
if (is_bad[i]) {
cout << "-1\n";
continue;
}
if (qu[i].second <= 0) {
cout << "0\n";
continue;
}
int k = qu[i].second;
Vector dir = qu[i].first;
vector<Vector> bst;
for (int i = 0; i < k + 5; ++i) {
auto res = get_bst(dir, hulls[i], k - i + 5);
/**vector<Vector> bst1;
int f1 = 0, f2 = 0;
for (int i = 0; i <= k && i < (int)bst.size() + res.size(); ++i) {
if (f2 >= res.size()) {
bst1.push_back(bst[f1++]);
} else if (f1 >= bst.size()) {
bst1.push_back(res[f2++]);
} else if (bst[f1] * dir > res[f2] * dir) {
bst1.push_back(bst[f1++]);
} else {
bst1.push_back(res[f2++]);
}
}
bst = move(bst1);*/
for (auto elem : res) {
bst.push_back(elem);
for (int i = (int)bst.size() - 1; i > 0; --i) {
if (dir * bst[i] > dir * bst[i - 1]) {
swap(bst[i], bst[i - 1]);
} else {
break;
}
}
if ((int)bst.size() > k) bst.pop_back();
}
}
long double ans = dir * bst[k - 1];
/// cout << (double)bst[k - 1].x << " " << (double)bst[k - 1].y << endl;
ans /= sqrtl(dir.x * dir.x + dir.y * dir.y);
ans = 0.5 / ans;
cout << ans << "\n";
if (ans < -1) {
cout << n << "\n";
for (int i = 0; i < n; ++i) {
cout << p[i].x << " " << p[i].y << "\n";
}
cout << qu[i].first.x << " " << qu[i].first.y << " " << qu[i].second << endl;
return 0;
}
}
return 0;
}