#include <bits/stdc++.h>
using namespace std;
const int N = 201;
const long long MOD = 1e9 + 7;
const double eps = 1e-9;
int gcd(int a, int b) { return b == 0 ? a : gcd(b, a % b); }
struct point {
  int x, y;
  point() {}
  point(int x, int y) {
    this->x = x;
    this->y = y;
  }
};
struct line {
  int a, b, c;
  line() {}
  line(point p1, point p2) {
    a = p1.y - p2.y;
    b = p2.x - p1.x;
    c = p1.x * p2.y - p2.x * p1.y;
    int g = gcd(gcd(a, b), c);
    a /= g, b /= g, c /= g;
    if (a < 0) a *= -1, b *= -1, c *= -1;
  }
  bool contains(point p) { return p.x * a + p.y * b + c == 0; }
  bool operator<(const line &o) const {
    if (a != o.a) return a < o.a;
    if (b != o.b) return b < o.b;
    return c < o.c;
  }
  bool operator==(const line &o) const {
    return a == o.a && b == o.b && c == o.c;
  }
};
struct matrix {
  vector<vector<double> > A;
  int n, m;
  matrix() {}
  matrix(int n, int m) {
    this->n = n;
    this->m = m;
    A.resize(n);
    for (int i = 0; i < n; i++) A[i].resize(m);
  }
  matrix(int n, int m, int o) {
    this->n = n;
    this->m = m;
    A.resize(n);
    for (int i = 0; i < n; i++) {
      A[i].resize(m);
      A[i][i] = o;
    }
  }
  matrix operator*(const matrix &o) const {
    matrix res(this->n, o.m);
    for (int i = 0; i < this->n; i++)
      for (int j = 0; j < o.m; j++)
        for (int k = 0; k < this->m; k++)
          res.A[i][j] += this->A[i][k] * o.A[k][j];
    return res;
  }
  matrix transpose() {
    matrix res(n, n);
    for (int i = 0; i < n; i++)
      for (int j = 0; j < n; j++) res.A[i][j] = A[j][i];
    return res;
  }
};
int n;
vector<point> P;
vector<line> L;
vector<vector<int> > a, b;
map<line, vector<int> > m;
matrix gi[14];
int main() {
  scanf("%d", &n);
  P.resize(n);
  for (int i = 0; i < n; i++) scanf("%d%d", &P[i].x, &P[i].y);
  for (int i = 0; i < n; i++)
    for (int j = i + 1; j < n; j++) L.push_back(line(P[i], P[j]));
  sort(L.begin(), L.end());
  L.resize(unique(L.begin(), L.end()) - L.begin());
  for (int i = 0; i < L.size(); i++)
    for (int j = 0; j < n; j++)
      if (L[i].contains(P[j])) m[L[i]].push_back(j);
  a.resize(P.size());
  b.resize(L.size());
  for (int i = 0; i < L.size(); i++) {
    vector<int> &v = m[L[i]];
    for (int j = 0; j < v.size(); j++) {
      a[v[j]].push_back(i);
      b[i].push_back(v[j]);
    }
  }
  matrix g(n, n);
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < a[i].size(); j++)
      for (int k = 0; k < b[a[i][j]].size(); k++)
        g.A[i][b[a[i][j]][k]] += 1.0 / (a[i].size() * b[a[i][j]].size());
  }
  gi[0] = g;
  for (int i = 1; i < 14; i++) gi[i] = gi[i - 1] * gi[i - 1];
  for (int i = 0; i < 14; i++) gi[i] = gi[i].transpose();
  int q, t, m;
  scanf("%d", &q);
  while (q--) {
    scanf("%d%d", &t, &m);
    t--, m--;
    matrix f(1, n);
    f.A[0][t] = 1.0;
    for (int i = 0; i < 14; i++)
      if (m & (1 << i)) f = f * gi[i];
    double ans = -1e9;
    for (int i = 0; i < L.size(); i++) {
      double cur = 0.0;
      for (int j = 0; j < b[i].size(); j++)
        cur += (1.0 / b[i].size()) * f.A[0][b[i][j]];
      ans = max(ans, cur);
    }
    printf("%.9lf\n", ans);
  }
  return 0;
}
