#include <bits/stdc++.h>
using namespace std;
vector<int> v[210][210];
int q, n, x[210], y[210], vs[210][210];
double f[14][210][210], a[210], b[210];
void power(int x) {
  for (; x; x &= x - 1) {
    int y = log2(x & -x);
    memset(b, 0, sizeof b);
    for (int k = 1; k <= n; k++)
      for (int j = 1; j <= n; j++) b[j] += a[k] * f[y][k][j];
    memcpy(a, b, sizeof b);
  }
}
int main() {
  scanf("%d", &n);
  for (int i = 1; i <= n; i++) scanf("%d%d", x + i, y + i);
  for (int i = 1; i <= n; i++) {
    int cnt = 0;
    for (int j = 1; j <= n; j++)
      if (j != i && !vs[i][j]) {
        int f = 0;
        for (int k = 1; k <= n; k++)
          if ((x[i] - x[j]) * (y[k] - y[j]) == (x[k] - x[j]) * (y[i] - y[j]))
            f = 1, v[i][j].push_back(k), vs[i][k] = j;
        if (f) ++cnt;
      }
    for (int j = 1; j <= n; j++)
      if (j != i)
        for (int k : v[i][j]) f[0][k][i] += 1. / cnt / v[i][j].size();
  }
  for (int t = 1; t < 14; t++) {
    for (int i = 1; i <= n; i++)
      for (int k = 1; k <= n; k++)
        for (int j = 1; j <= n; j++)
          f[t][i][j] += f[t - 1][i][k] * f[t - 1][k][j];
  }
  scanf("%d", &q);
  while (q--) {
    int t, m;
    scanf("%d%d", &t, &m);
    double ans = 0;
    memset(a, 0, sizeof a), a[t] = 1;
    power(m - 1);
    for (int i = 1; i <= n; i++)
      for (int j = 1; j <= n; j++)
        if (v[j][vs[j][i]].size()) {
          double s = 0;
          for (int k : v[j][vs[j][i]]) s += a[k];
          ans = max(ans, s / v[j][vs[j][i]].size());
        }
    printf("%.10lf\n", ans);
  }
  return 0;
}
