#include <bits/stdc++.h>
using namespace std;
int M = 10010;
class Solution {
 public:
  Solution(vector<pair<int, int>>& pos)
      : points(pos),
        pb(pos.size(), vector<double>(pos.size(), 0.0)),
        point2lines(pos.size()) {
    build();
  }
  vector<double> query(vector<pair<int, int>>& qs) {
    vector<double> res;
    res.reserve(qs.size());
    for (auto& q : qs) {
      res.push_back(query(q.first, q.second));
    }
    return res;
  }
  double query(int t, int m) {
    int n = points.size();
    if (m == 1) {
      int minSize = n;
      for (auto l : point2lines[t]) {
        minSize = min(minSize, (int)lines[l].size());
      }
      return 1.0 / minSize;
    }
    --m;
    vector<vector<double>> I(n, vector<double>(1, 0.0));
    I[t][0] = 1.0;
    vector<vector<double>> tmp = I;
    for (int i = 0, f = 1; i < mats.size(); ++i, f <<= 1) {
      if (m & f) {
        matrixProduct(mats[i], I, tmp);
        tmp.swap(I);
      }
    }
    double res = 0.0;
    for (auto line : lines) {
      double cand = 0.0;
      for (auto i : line) {
        cand += I[i][0];
      }
      cand /= line.size();
      res = max(res, cand);
    }
    return res;
  }

 private:
  vector<pair<int, int>> points;
  vector<vector<int>> lines;
  vector<vector<double>> pb;
  vector<vector<vector<double>>> mats;
  vector<vector<int>> point2lines;
  void build() {
    int n = points.size();
    lines.reserve(n * n);
    vector<int> ps;
    vector<vector<bool>> checked(n, vector<bool>(n, false));
    for (int i = 0; i < n; ++i) {
      checked[i][i] = true;
    }
    for (int i = 0; i < n; ++i) {
      for (int j = i + 1; j < n; ++j) {
        if (checked[i][j]) {
          continue;
        }
        ps.clear();
        ps.reserve(n);
        ps.push_back(i);
        ps.push_back(j);
        bool added = false;
        for (int k = 0; k < n; ++k) {
          if (k == i || k == j) {
            continue;
          }
          if (crossProduct(points[i], points[j], points[k]) == 0) {
            if (checked[k][i]) {
              added = true;
              break;
            }
            ps.push_back(k);
          }
        }
        if (!added) {
          for (auto k : ps) {
            point2lines[k].push_back(lines.size());
            checked[i][k] = true;
            checked[k][i] = true;
          }
          lines.push_back(ps);
        }
      }
    }
    for (int i = 0; i < n; ++i) {
      for (auto l : point2lines[i]) {
        for (auto j : lines[l]) {
          pb[i][j] += 1.0 / (lines[l].size() * point2lines[i].size());
        }
      }
    }
    int m = 1;
    while (1 << m < M) {
      ++m;
    }
    mats.reserve(m);
    mats.push_back(pb);
    vector<vector<double>> mat(n, vector<double>(n, 0.0));
    while (--m > 0) {
      matrixProduct(mats.back(), mats.back(), mat);
      mats.push_back(mat);
    }
  }
  long long crossProduct(const pair<int, int>& a, const pair<int, int>& b,
                         const pair<int, int>& c) {
    return (0LL + b.first - a.first) * (0LL + c.second - a.second) -
           (0LL + c.first - a.first) * (0LL + b.second - a.second);
  }
  void matrixProduct(const vector<vector<double>>& A,
                     const vector<vector<double>>& B,
                     vector<vector<double>>& C) {
    int n = A.size();
    int l = B.size();
    int m = B[0].size();
    for (int i = 0; i < n; ++i) {
      for (int j = 0; j < m; ++j) {
        C[i][j] = 0.0;
        for (int k = 0; k < l; ++k) {
          C[i][j] += A[i][k] * B[k][j];
        }
      }
    }
  }
};
int main(int argc, char** argv) {
  int n;
  scanf("%d", &n);
  vector<pair<int, int>> points;
  points.reserve(n);
  for (int i = 0, u = 0, v = 0; i < n; ++i) {
    scanf("%d%d", &u, &v);
    points.emplace_back(u - 1, v - 1);
  }
  Solution sol(points);
  int q;
  scanf("%d", &q);
  vector<pair<int, int>> querys;
  querys.reserve(q);
  for (int i = 0, t = 0, m = 0; i < q; ++i) {
    scanf("%d%d", &t, &m);
    querys.emplace_back(t - 1, m);
  }
  auto res = sol.query(querys);
  for (auto d : res) {
    printf("%.12f\n", d);
  }
  return 0;
}
