#include <bits/stdc++.h>
using namespace std;
const int maxn = 210;
int n, vis[maxn][maxn], Q;
vector<int> belong[maxn];
vector<vector<int> > lines;
double val[maxn], ans;
struct point {
  int x, y;
} e[maxn];
struct Mat {
  double a[maxn][maxn];
  void clear() {
    memset(a, 0, sizeof(a));
    for (int i = 1; i <= n; i++) a[i][i] = 1;
  }
  void init() { memset(a, 0, sizeof(a)); }
} a[maxn], b[maxn];
Mat operator*(Mat a, Mat b) {
  Mat c;
  c.init();
  for (int i = 1; i <= n; i++)
    for (int j = 1; j <= n; j++)
      for (int k = 1; k <= n; k++) c.a[i][j] += a.a[i][k] * b.a[k][j];
  return c;
}
point operator-(point a, point b) {
  point c;
  c.x = a.x - b.x;
  c.y = a.y - b.y;
  return c;
}
int operator*(point a, point b) { return a.x * b.y - a.y * b.x; }
int main() {
  scanf("%d", &n);
  for (int i = 1; i <= n; i++) scanf("%d%d", &e[i].x, &e[i].y);
  for (int i = 1; i <= n; i++)
    for (int j = i + 1; j <= n; j++)
      if (!vis[i][j]) {
        vector<int> line;
        for (int k = 1; k <= n; k++)
          if ((e[k] - e[i]) * (e[k] - e[j]) == 0) line.push_back(k);
        for (int k = 0; k < line.size(); k++)
          belong[line[k]].push_back((int)lines.size());
        for (int p = 0; p < line.size(); p++)
          for (int q = 0; q < line.size(); q++) {
            int y1 = line[p], y2 = line[q];
            vis[y1][y2] = 1;
          }
        lines.push_back(line);
      }
  a[0].clear();
  for (int i = 1; i <= n; i++)
    for (int j = 0; j < belong[i].size(); j++) {
      int t = belong[i][j];
      double temp = 1.0 / belong[i].size() / lines[t].size();
      for (int k = 0; k < lines[t].size(); k++) {
        int v = lines[t][k];
        a[1].a[i][v] += temp;
      }
    }
  for (int i = 2; i <= 100; i++) a[i] = a[i - 1] * a[1];
  b[0].clear();
  b[1] = a[100];
  for (int i = 2; i <= 100; i++) b[i] = b[i - 1] * b[1];
  scanf("%d", &Q);
  while (Q--) {
    ans = 0.0;
    int t, m;
    scanf("%d%d", &t, &m);
    m--;
    memset(val, 0, sizeof(val));
    for (int i = 1; i <= n; i++)
      for (int j = 1; j <= n; j++)
        val[i] += b[m / 100].a[i][j] * a[m % 100].a[j][t];
    for (int i = 0; i < lines.size(); i++) {
      vector<int> t = lines[i];
      double temp = 0.0;
      for (int j = 0; j < t.size(); j++) temp += val[t[j]];
      temp /= t.size();
      ans = max(ans, temp);
    }
    printf("%.15lf\n", ans);
  }
  return 0;
}
