#include <bits/stdc++.h>
using namespace std;
FILE *in, *out;
int N, M;
vector<pair<int, int> > ar(210);
double pr[210][210];
double prlog[20][210][210];
inline int cross(pair<int, int> x, pair<int, int> y, pair<int, int> z) {
  int x1 = y.first - x.first;
  int y1 = y.second - x.second;
  int x2 = z.first - x.first;
  int y2 = z.second - x.second;
  return x1 * y2 - x2 * y1;
}
vector<vector<int> > groups;
vector<int> used(210, 0);
vector<int> que(210, 0);
int qson;
int build_graph() {
  int i, j, k, t, z;
  for (i = 0; i < N; i++) {
    fill(used.begin(), used.end(), 0);
    used[i] = 1;
    for (j = 0, t = 0; j < N; j++) {
      if (used[j]) continue;
      used[j] = 1;
      qson = 0;
      que[qson] = i;
      qson++;
      que[qson] = j;
      qson++;
      for (k = 0; k < N; k++) {
        if (used[k]) continue;
        if (cross(ar[i], ar[j], ar[k]) != 0) continue;
        used[k] = 1;
        que[qson] = k;
        qson++;
      }
      for (k = 0; k < qson; k++) {
        pr[i][que[k]] += (double)1 / (double)(qson);
      }
      if (i < j) groups.push_back(vector<int>(que.begin(), que.begin() + qson));
      t++;
    }
    for (j = 0; j < N; j++) {
      pr[i][j] /= (double)t;
    }
  }
  for (i = 0, z = 1; z <= 10000; i++, z *= 2) {
    for (j = 0; j < N; j++) {
      for (k = 0; k < N; k++) {
        if (i == 0) {
          prlog[i][j][k] = pr[j][k];
          continue;
        }
        for (t = 0; t < N; t++) {
          prlog[i][j][k] += prlog[i - 1][j][t] * prlog[i - 1][t][k];
        }
      }
    }
  }
  return 0;
}
double solve(int ind, int mov) {
  int i, j, k, t, z;
  int first_flag = 1;
  vector<double> sol(N, 0.000000000);
  sol[ind - 1] = 1.00000000;
  mov--;
  vector<double> temp(N, 0.00000000);
  for (i = 0, j = 1; j <= mov; i++, j *= 2) {
    if ((mov & j)) {
      for (k = 0; k < N; k++) {
        temp[k] = 0.00000;
      }
      for (k = 0; k < N; k++) {
        for (t = 0; t < N; t++) {
          temp[t] += sol[k] * prlog[i][t][k];
        }
      }
      for (k = 0; k < N; k++) {
        sol[k] = temp[k];
      }
    }
  }
  double ans = 0.00000000;
  for (i = 0; i < groups.size(); i++) {
    double temp = 0.00000000;
    for (j = 0; j < groups[i].size(); j++) {
      temp += sol[groups[i][j]] * (1 / (double)groups[i].size());
    }
    ans = max(ans, temp);
  }
  return ans;
}
int read() {
  int i, j, k;
  fscanf(in, "%d", &N);
  for (i = 0; i < N; i++) {
    fscanf(in, "%d%d", &ar[i].first, &ar[i].second);
  }
  build_graph();
  fscanf(in, "%d", &M);
  for (i = 0; i < M; i++) {
    fscanf(in, "%d%d", &j, &k);
    printf("%.8lf\n", solve(j, k));
  }
  return 0;
}
int main() {
  in = stdin;
  out = stdout;
  read();
  return 0;
}
