#include <bits/stdc++.h>
using namespace std;
#pragma optimize("-O3")
int n;
int x[250];
int y[250];
bool vis[250];
vector<vector<vector<int>>> v;
double dp[201][201][21];
bool first(int x1, int y1, int x2, int y2, int x3, int y3) {
  if ((y2 - y1) * (x3 - x1) == (y3 - y1) * (x2 - x1)) {
    return 1;
  }
  return 0;
}
int main() {
  ios::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  cout << setprecision(20);
  cin >> n;
  v.resize(n);
  for (int i = 0; i < n; i++) {
    cin >> x[i] >> y[i];
  }
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < n; j++) {
      vis[j] = 0;
    }
    vis[i] = 1;
    for (int j = 0; j < n; j++) {
      if (vis[j] == 1) {
        continue;
      }
      vis[j] = 1;
      vector<int> vec;
      vec.push_back(j);
      vec.push_back(i);
      for (int k = 0; k < n; k++) {
        if (vis[k]) {
          continue;
        }
        if (first(x[i], y[i], x[j], y[j], x[k], y[k])) {
          vec.push_back(k);
          vis[k] = 1;
        }
      }
      v[i].push_back(vec);
    }
  }
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < n; j++) {
      dp[i][j][0] = 0;
    }
    dp[i][i][0] = 1;
    for (int it = 1; it <= 20; it++) {
      for (int j = 0; j < n; j++) {
        int sz = v[j].size();
        for (int k = 0; k < v[j].size(); k++) {
          int sz2 = v[j][k].size();
          for (auto u : v[j][k]) {
            dp[i][u][it] += (((dp[i][j][it - 1]) / sz) / sz2);
          }
        }
      }
    }
  }
  int q;
  cin >> q;
  while (q--) {
    int t, m;
    cin >> t >> m;
    t--;
    m = min(m, 20);
    double maxi = 0;
    for (int i = 0; i < n; i++) {
      maxi = max(maxi, dp[i][t][m]);
    }
    for (int i = 0; i < n; i++) {
      for (auto u : v[i]) {
        double val = 0;
        int sz = u.size();
        for (auto u2 : u) {
          val += dp[u2][t][m - 1];
        }
        val = val / sz;
        maxi = max(maxi, val);
      }
    }
    cout << setprecision(20) << maxi << '\n';
  }
  return 0;
}
