#include <bits/stdc++.h>
template <typename T>
inline void read(T &x) {
  x = 0;
  char c = getchar();
  bool flag = false;
  while (!isdigit(c)) {
    if (c == '-') flag = true;
    c = getchar();
  }
  while (isdigit(c)) x = x * 10 + (c ^ 48), c = getchar();
  if (flag) x = -x;
}
using namespace std;
const double eps = 1e-8;
inline double F(double x) { return x < 0 ? -x : x; }
template <typename T>
inline void MAX(T &a, T b) {
  if (a < b) a = b;
}
int n;
struct Vectors {
  int x, y;
  Vectors(int xx = 0, int yy = 0) { x = xx, y = yy; }
  inline Vectors operator+(const Vectors &a) const {
    return Vectors(x + a.x, y + a.y);
  }
  inline Vectors operator-(const Vectors &a) const {
    return Vectors(x - a.x, y - a.y);
  }
  inline int operator*(const Vectors &a) const { return x * a.y - y * a.x; }
} vt[222];
vector<int> jzp_line[222][222];
vector<pair<int, int> > blong[222];
int ltot;
struct matrix {
  double h[222][222];
  matrix() { memset(h, 0, sizeof(h)); }
  inline void clear() { memset(h[1], 0, sizeof(h[1])); }
  inline matrix operator+(const matrix &a) const {
    matrix mt;
    for (int i = 1; i <= 1; ++i) {
      for (int k = 1; k <= n; ++k)
        if (F(h[i][k]) > eps) {
          for (int j = 1; j <= n; ++j) {
            mt.h[i][j] += h[i][k] * a.h[k][j];
          }
        }
    }
    return mt;
  }
  inline matrix operator*(const matrix &a) const {
    matrix mt;
    for (int i = 1; i <= n; ++i) {
      for (int k = 1; k <= n; ++k)
        if (F(h[i][k]) > eps) {
          for (int j = 1; j <= n; ++j) {
            mt.h[i][j] += h[i][k] * a.h[k][j];
          }
        }
    }
    return mt;
  }
} A, B[15];
inline void Pow(matrix &res, int k) {
  for (int j = 0; k; ++j)
    if ((k >> j) & 1) {
      k ^= (1 << j);
      res = res * B[j];
    }
}
inline void work() {
  int t, m;
  read(t), read(m);
  A.clear();
  A.h[1][t] = 1;
  Pow(A, m - 1);
  double ans = 0;
  for (int i = 1; i <= n; ++i) {
    for (int j = i + 1; j <= n; ++j) {
      double res = 0;
      for (unsigned int k = 0; k < jzp_line[i][j].size(); ++k) {
        res += A.h[1][jzp_line[i][j][k]];
      }
      MAX(ans, res / jzp_line[i][j].size());
    }
  }
  printf("%.10lf\n", ans);
}
int main() {
  read(n);
  for (int i = 1; i <= n; ++i) read(vt[i].x), read(vt[i].y);
  for (int i = 1; i <= n; ++i) {
    for (int j = i + 1; j <= n; ++j) {
      bool flag = false;
      for (int k = 1; k < j; ++k)
        if (k != i && (vt[k] - vt[i]) * (vt[j] - vt[i]) == 0) {
          flag = true;
          break;
        }
      if (!flag) {
        ++ltot;
        for (int k = 1; k <= n; ++k)
          if ((vt[k] - vt[i]) * (vt[j] - vt[i]) == 0) {
            jzp_line[i][j].push_back(k);
            blong[k].push_back(make_pair(i, j));
          }
      }
    }
  }
  for (int i = 1; i <= n; ++i) {
    for (unsigned int lj = 0; lj < blong[i].size(); ++lj) {
      int a = blong[i][lj].first, b = blong[i][lj].second;
      for (unsigned int jzp = 0; jzp < jzp_line[a][b].size(); ++jzp) {
        int j = jzp_line[a][b][jzp];
        B[0].h[j][i] += 1.0 / blong[i].size() / jzp_line[a][b].size();
      }
    }
  }
  for (int j = 1; j <= 13; ++j) B[j] = B[j - 1] * B[j - 1];
  int q;
  read(q);
  while (q--) work();
  return 0;
}
