#include <bits/stdc++.h>
using namespace std;
const int MAXN = 201;
const int MAXM = 15;
int n, q;
int x[MAXN], y[MAXN];
int vis[MAXN], cnt[MAXN];
double ans;
double f[MAXN][MAXN][MAXM + 1];
double Base[MAXN], zy[MAXN];
vector<int> point[MAXN][MAXN];
vector<pair<int, int> > line;
inline int Read() {
  int i = 0, f = 1;
  char c;
  for (c = getchar(); (c > '9' || c < '0') && c != '-'; c = getchar())
    ;
  if (c == '-') f = -1, c = getchar();
  for (; c >= '0' && c <= '9'; c = getchar()) i = (i << 3) + (i << 1) + c - '0';
  return i * f;
}
bool check(int a, int b, int c) {
  return (y[b] - y[a]) * (x[c] - x[a]) == (y[c] - y[a]) * (x[b] - x[a]);
}
int main() {
  n = Read();
  for (int i = 1; i <= n; ++i) x[i] = Read(), y[i] = Read();
  for (int i = 1; i <= n; ++i) {
    memset(vis, 0, sizeof(vis));
    for (int j = 1; j <= n; ++j) {
      if (i == j) continue;
      if (vis[j]) continue;
      cnt[i]++;
      for (int k = 1; k <= n; ++k) {
        if (check(i, j, k)) {
          point[i][j].push_back(k);
          vis[k] = 1;
        }
      }
      line.push_back(make_pair(point[i][j][0], point[i][j][1]));
    }
  }
  sort(line.begin(), line.end());
  line.erase(unique(line.begin(), line.end()), line.end());
  int siz1 = line.size();
  for (int i = 0; i < siz1; ++i) {
    vector<int> &vec = point[line[i].first][line[i].second];
    int siz2 = vec.size();
    for (int j = 0; j < siz2; ++j) {
      for (int k = 0; k < siz2; ++k) {
        f[vec[j]][vec[k]][0] += 1.0 / siz2 * 1.0;
      }
    }
  }
  for (int i = 1; i <= n; ++i) {
    for (int j = 1; j <= n; ++j) {
      f[i][j][0] /= cnt[i];
    }
  }
  for (int i = 1; i <= MAXM; ++i) {
    for (int j = 1; j <= n; ++j) {
      for (int k = 1; k <= n; ++k) {
        if (f[j][k][i - 1] > 1e-6) {
          for (int t = 1; t <= n; ++t) {
            f[j][t][i] += f[j][k][i - 1] * f[k][t][i - 1];
          }
        }
      }
    }
  }
  q = Read();
  while (q--) {
    int t = Read(), step = Read() - 1;
    memset(Base, 0, sizeof(Base));
    Base[t] = 1;
    for (int i = 0; i <= MAXM; ++i) {
      if ((1 << i) > step) break;
      if ((1 << i) & step) {
        memset(zy, 0, sizeof(zy));
        for (int j = 1; j <= n; ++j) {
          if (Base[j] > 1e-6) {
            for (int k = 1; k <= n; ++k) {
              zy[k] += f[k][j][i] * Base[j];
            }
          }
        }
        memcpy(Base, zy, sizeof(zy));
      }
    }
    ans = 0.0;
    int siz = line.size();
    for (int i = 0; i < siz; ++i) {
      vector<int> &vec = point[line[i].first][line[i].second];
      double tot = 0.0;
      int siz2 = vec.size();
      for (int j = 0; j < siz2; ++j) {
        tot += Base[vec[j]];
      }
      tot /= 1.0 * siz2;
      ans = max(ans, tot);
    }
    memset(zy, 0, sizeof(zy));
    for (int i = 1; i <= n; ++i) {
      if (Base[i] > 1e-6) {
        for (int j = 1; j <= n; ++j) {
          zy[j] += Base[i] * f[j][i][0];
        }
      }
    }
    memcpy(Base, zy, sizeof(zy));
    for (int i = 1; i <= n; ++i) ans = max(ans, Base[i]);
    printf("%.10lf\n", ans);
  }
  return 0;
}
