#include <bits/stdc++.h>
using namespace std;
inline int Get() {
  int x = 0, f = 1;
  char ch = getchar();
  while (ch < '0' || ch > '9') {
    if (ch == '-') f = -1;
    ch = getchar();
  }
  while ('0' <= ch && ch <= '9') {
    x = (x << 1) + (x << 3) + ch - '0';
    ch = getchar();
  }
  return x * f;
}
int n, m;
int x[205], y[205];
int cnt[205][205];
bool pd(int a, int b, int c) {
  if (x[a] == x[b] && x[b] == x[c]) return 1;
  if (y[a] == y[b] && y[b] == y[c]) return 1;
  if (x[b] > x[c]) swap(b, c);
  if (x[a] > x[b]) swap(a, b);
  return (y[b] - y[a]) * (x[c] - x[a]) == (y[c] - y[a]) * (x[b] - x[a]);
}
long double rate[205][205][15];
long double tem[205], g[205];
int line[205];
void cal(int x) {
  memset(g, 0, sizeof(g));
  for (int i = 1; i <= n; i++) {
    for (int j = 1; j <= n; j++) {
      g[i] += tem[j] * rate[i][j][x];
    }
  }
  memcpy(tem, g, sizeof(tem));
}
void work(int k, int ed) {
  memset(tem, 0, sizeof(tem));
  tem[ed] = 1;
  for (int x = 0; k; k >>= 1, x++) {
    if (k & 1) cal(x);
  }
}
vector<int> L[205 * 205];
int id;
bool fir[205][205];
int main() {
  n = Get();
  for (int i = 1; i <= n; i++) x[i] = Get(), y[i] = Get();
  for (int i = 1; i <= n; i++) {
    line[i] = n - 1;
    for (int j = 1; j <= n; j++) {
      if (i == j) continue;
      cnt[i][j] = 2;
      for (int k = 1; k <= n; k++) {
        if (k != i && k != j && pd(i, j, k)) {
          cnt[i][j]++;
        }
      }
    }
  }
  for (int i = 1; i <= n; i++) {
    line[i] = n - 1;
    for (int j = 1; j <= n; j++) {
      if (i == j) continue;
      for (int k = 1; k < j; k++) {
        if (k == i) continue;
        if (pd(i, j, k)) {
          line[i]--;
          break;
        }
      }
    }
  }
  for (int i = 1; i <= n; i++) {
    for (int j = 1; j <= n; j++) {
      if (i != j) {
        rate[i][i][0] +=
            (long double)1.0 / line[i] / cnt[i][j] / (cnt[i][j] - 1);
      }
    }
    for (int j = 1; j <= n; j++) {
      if (i == j) continue;
      rate[i][j][0] = (long double)1.0 / cnt[i][j] / line[i];
    }
  }
  for (int i = 1; i <= n; i++) {
    for (int j = i + 1; j <= n; j++) {
      int flag = 0;
      for (int k = 1; k <= j; k++)
        if (k != i && k != j && pd(i, j, k)) {
          flag = 1;
          break;
        }
      if (!flag) {
        id++;
        L[id].push_back(i);
        L[id].push_back(j);
        for (int k = 1; k <= n; k++) {
          if (k != i && k != j && pd(i, j, k)) L[id].push_back(k);
        }
      }
    }
  }
  for (int q = 1; q <= 14; q++) {
    for (int i = 1; i <= n; i++) {
      for (int j = 1; j <= n; j++) {
        for (int k = 1; k <= n; k++) {
          rate[i][j][q] += rate[i][k][q - 1] * rate[k][j][q - 1];
        }
      }
    }
  }
  m = Get();
  int a, b;
  while (m--) {
    long double ans = 0;
    a = Get(), b = Get();
    work(b - 1, a);
    for (int i = 1; i <= id; i++) {
      long double now = 0;
      for (int j = 0; j < L[i].size(); j++) {
        now += tem[L[i][j]] / L[i].size();
      }
      ans = max(ans, now);
    }
    cout << fixed << setprecision(20) << ans << "\n";
  }
  return 0;
}
