#include <bits/stdc++.h>
using namespace std;
int n, e[15], line[210 * 210][210], tot, bz[210][210], cnt[210];
struct pts {
  int x, y;
  pts friend operator+(pts a, pts b) {
    pts c;
    c.x = a.x + b.x;
    c.y = a.y + b.y;
    return c;
  }
  pts friend operator-(pts a, pts b) {
    pts c;
    c.x = a.x - b.x;
    c.y = a.y - b.y;
    return c;
  }
  int friend operator/(pts a, pts b) { return a.x * b.y - a.y * b.x; }
} a[210];
struct node {
  double a[210][210];
  node() { memset(a, 0, sizeof(a)); };
  node friend operator*(node a, node b) {
    node c;
    for (int i = 1; i <= n; i++) {
      for (int j = 1; j <= n; j++) {
        for (int k = 1; k <= n; k++) {
          c.a[i][k] += a.a[i][j] * b.a[j][k];
        }
      }
    }
    return c;
  }
} f[14];
struct note {
  double a[210];
  note() { memset(a, 0, sizeof(a)); };
} b;
note operator*(note a, node b) {
  note c;
  for (int i = 1; i <= n; i++) {
    for (int j = 1; j <= n; j++) {
      c.a[j] += a.a[i] * b.a[i][j];
    }
  }
  return c;
}
bool crossing(int i, int j, int k) {
  return ((a[j] - a[i]) / (a[k] - a[i])) == 0;
}
void mi(int m) {
  int x = 0;
  for (int i = 13; i >= 0; i--)
    if (x + e[i] <= m) {
      x += e[i];
      b = b * f[i];
    }
}
int main() {
  e[0] = 1;
  for (int i = 1; i <= 14; i++) e[i] = e[i - 1] * 2;
  scanf("%d", &n);
  for (int i = 1; i <= n; i++) scanf("%d%d", &a[i].x, &a[i].y);
  for (int i = 1; i <= n; i++) {
    for (int j = 1; j <= n; j++)
      if (i != j && !bz[i][j]) {
        tot++;
        for (int k = 1; k <= n; k++)
          if (crossing(i, j, k)) line[tot][++line[tot][0]] = k, cnt[k]++;
        for (int k = 1; k <= line[tot][0]; k++) {
          for (int l = 1; l <= line[tot][0]; l++)
            bz[line[tot][k]][line[tot][l]] = bz[line[tot][l]][line[tot][k]] = 1;
        }
      }
  }
  for (int i = 1; i <= tot; i++) {
    for (int k = 1; k <= line[i][0]; k++) {
      for (int j = 1; j <= line[i][0]; j++) {
        f[0].a[line[i][k]][line[i][j]] += 1.0 / cnt[line[i][j]] / line[i][0];
      }
    }
  }
  for (int j = 1; j <= 13; j++) f[j] = f[j - 1] * f[j - 1];
  int ac;
  scanf("%d", &ac);
  while (ac--) {
    int t, m;
    scanf("%d%d", &t, &m);
    memset(b.a, 0, sizeof(b.a));
    b.a[t] = 1;
    mi(m - 1);
    double ans = 0;
    for (int i = 1; i <= tot; i++) {
      double jy = 0;
      for (int k = 1; k <= line[i][0]; k++) jy += b.a[line[i][k]] / line[i][0];
      ans = max(ans, jy);
    }
    printf("%.10lf\n", ans);
  }
}
