#include <bits/stdc++.h>
using namespace std;
const int maxn = 222;
const int INF = 0x3f3f3f3f;
int x[maxn], y[maxn];
vector<vector<int> > li[maxn];
int n, q, s, t;
struct mat {
  long double a[maxn][maxn];
  mat() {}
  mat(int n, bool f = 0) {
    memset(a, 0, sizeof a);
    if (f)
      for (int i = 0; i < n; ++i) a[i][i] = (long double)1.0f;
  }
  mat(long double b[maxn][maxn]) { memcpy(a, b, sizeof a); }
  void mul(mat b) {
    long double t[maxn][maxn] = {};
    for (int i = 0; i < n; ++i)
      for (int j = 0; j < n; ++j) {
        for (int k = 0; k < n; ++k) {
          t[i][j] += a[i][k] * b.a[k][j];
        }
      }
    memcpy(a, t, sizeof a);
  }
  void pow(int x) {
    if (x == 1) return;
    mat tmp = mat(a);
    memset(a, 0, sizeof a);
    for (int i = 0; i < n; ++i) a[i][i] = (long double)1.0f;
    while (x) {
      if (x & 1) mul(tmp);
      tmp.mul(tmp);
      x >>= 1;
    }
  }
} p[16];
struct mat2 {
  long double a[maxn];
  mat2() {}
  mat2(mat m, int s) {
    for (int i = 0; i < n; ++i) a[i] = m.a[i][s];
  }
  void mul(mat b) {
    long double ans[maxn] = {};
    for (int i = 0; i < n; ++i) {
      for (int k = 0; k < n; ++k) {
        ans[i] += b.a[i][k] * a[k];
      }
    }
    memcpy(a, ans, sizeof a);
  }
  void pow(int x) {
    int t = 1;
    while (x) {
      if (x & 1) mul(p[t]);
      x >>= 1;
      t++;
    }
  }
};
void initMat(mat tmp) {
  p[1] = tmp;
  for (int i = 2; i < 16; ++i) {
    p[i] = p[i - 1];
    p[i].mul(p[i]);
  }
}
struct line {
  int p;
  long double k;
};
struct line2 {
  long double k;
  int sz;
};
bool cmp(line a, line b) { return a.k < b.k; }
inline long double getk(int i, int j) {
  if (x[i] == x[j]) return 1e10;
  return (y[i] - y[j]) * 1.0L / (x[i] - x[j]);
}
long double ans1[maxn];
void init(mat &tmp) {
  for (int i = 0; i < n; ++i) {
    vector<line> v;
    for (int j = 0; j < n; ++j) {
      if (i == j) continue;
      v.push_back({j, getk(i, j)});
    }
    sort(v.begin(), v.end(), cmp);
    vector<line2> k;
    int tmpsz = 1;
    int mn = n;
    long double tmpk = v[0].k;
    vector<int> tl;
    tl.assign(1, i);
    tl.push_back(v[0].p);
    for (int j = 1; j < v.size(); ++j) {
      if (v[j].k == tmpk) {
        tmpsz++;
        tl.push_back(v[j].p);
      } else {
        k.push_back({tmpk, tmpsz});
        mn = min(mn, tmpsz + 1);
        tmpk = v[j].k;
        tmpsz = 1;
        li[i].push_back(tl);
        tl.assign(1, i);
        tl.push_back(v[j].p);
      }
    }
    k.push_back({tmpk, tmpsz});
    li[i].push_back(tl);
    mn = min(mn, tmpsz + 1);
    int sz = k.size();
    long double other = 0;
    for (int j = 0; j < n; ++j) {
      if (i == j) continue;
      for (line2 l : k) {
        if (l.k == getk(i, j)) {
          tmp.a[i][j] = 1.0L / (sz * (l.sz + 1));
          other += tmp.a[i][j];
          break;
        }
      }
    }
    tmp.a[i][i] = 1 - other;
    ans1[i] = 1.0L / mn;
  }
}
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cin >> n;
  for (int i = 0; i < n; ++i) cin >> x[i] >> y[i];
  mat tmp(n);
  init(tmp);
  initMat(tmp);
  cin >> q;
  while (q--) {
    cin >> s >> t;
    s--;
    mat2 ans(tmp, s);
    if (t == 1) {
      cout << fixed << setprecision(20) << ans1[s] << endl;
      continue;
    }
    ans.pow(t - 2);
    long double mx = 0;
    for (auto l : li[s]) {
      long double anst = 0;
      for (auto d : l) {
        anst += ans.a[d];
      }
      mx = max(mx, anst / l.size());
    }
    cout << fixed << setprecision(20) << mx << endl;
  }
  return 0;
}
