#include <bits/stdc++.h>
using namespace std;
const long long N = 2e2 + 5, M = 1e6 + 5, level = 25, MOD = 998244353,
                MX = 1e18 + 5, MN = -MX;
template <typename T>
T gcd(T a, T b) {
  if (b == 0) return a;
  return gcd(b, a % b);
}
template <typename T>
struct mat;
void printMat(mat<double> m);
template <typename T>
struct mat {
  vector<vector<T>> arr;
  int r, c;
  mat(int r, int c) {
    arr.resize(r);
    for (int i = 0; i < r; ++i) {
      arr[i].resize(c);
    }
    this->r = r;
    this->c = c;
  }
  mat makeIdentity() {
    mat res(r, c);
    for (int i = 0; i < r; ++i) {
      for (int j = 0; j < c; ++j) {
        if (i == j)
          res.arr[i][j] = 1;
        else
          res.arr[i][j] = 0;
      }
    }
    return res;
  }
  mat operator*(const mat &m2) const {
    mat<T> res(r, m2.c);
    for (int i = 0; i < r; ++i) {
      for (int j = 0; j < m2.c; ++j) {
        res.arr[i][j] = 0;
        for (int k = 0; k < c; ++k) {
          res.arr[i][j] += arr[i][k] * m2.arr[k][j];
        }
      }
    }
    return res;
  }
};
mat<double> power(mat<double> &m, int p) {
  if (p == 0) return m.makeIdentity();
  if (p == 1) return m;
  mat<double> m2 = m * m;
  if (p & 1) {
    return m * power(m2, p >> 1);
  }
  return power(m2, p >> 1);
}
int n;
pair<int, int> pts[N];
pair<int, int> simplify(pair<int, int> p) {
  int xDiff = p.first;
  int yDiff = p.second;
  if (xDiff < 0 and yDiff < 0) {
    xDiff *= -1;
    yDiff *= -1;
  } else if (yDiff < 0) {
    xDiff *= -1;
    yDiff *= -1;
  }
  int g = gcd(abs(xDiff), yDiff);
  if (g != 0) {
    xDiff /= g;
    yDiff /= g;
  }
  return {xDiff, yDiff};
}
pair<pair<int, int>, pair<int, int>> getLine(pair<int, int> p1,
                                             pair<int, int> p2) {
  pair<int, int> a = simplify({p2.second - p1.second, p2.first - p1.first});
  if (a.first == 0) a.second = 1;
  if (a.second == 0) a.first = 1;
  pair<int, int> b = simplify(
      {p1.second * p2.first - p2.second * p1.first, p1.first - p2.first});
  if (b.second == 0) b.first = p1.first;
  return {a, b};
}
set<pair<pair<int, int>, pair<int, int>>> pointToLine[N];
void printMat(mat<double> m) {
  for (int i = 0; i < m.r; ++i) {
    for (int j = 0; j < m.c; ++j) {
      cout << m.arr[i][j] << " ";
    }
    cout << endl;
  }
}
map<pair<pair<int, int>, pair<int, int>>, set<int>> lines;
int main() {
  scanf("%d", &n);
  for (int i = 0; i < n; ++i) {
    scanf("%d%d", &pts[i].first, &pts[i].second);
    for (int j = 0; j < i; ++j) {
      pair<pair<int, int>, pair<int, int>> line = getLine(pts[i], pts[j]);
      lines[line].insert(i);
      lines[line].insert(j);
      pointToLine[i].insert(line);
      pointToLine[j].insert(line);
    }
  }
  mat<double> m(n, n);
  for (int i = 0; i < n; ++i) {
    for (int j = 0; j < n; ++j) {
      if (i == j) continue;
      pair<pair<int, int>, pair<int, int>> line = getLine(pts[i], pts[j]);
      double probToLine = 1.0 / pointToLine[i].size();
      m.arr[i][j] = probToLine * (1.0 / lines[line].size());
    }
  }
  for (int i = 0; i < n; ++i) {
    m.arr[i][i] = 0.0;
    double probToLine = 1.0 / pointToLine[i].size();
    for (pair<pair<int, int>, pair<int, int>> line : pointToLine[i]) {
      m.arr[i][i] += probToLine * (1.0 / lines[line].size());
    }
  }
  vector<mat<double>> matP;
  matP.push_back(m);
  for (int i = 1; i <= 14; i++) {
    matP.push_back(matP.back() * matP.back());
  }
  int q;
  scanf("%d", &q);
  while (q--) {
    int pt, s;
    scanf("%d%d", &pt, &s);
    pt--;
    s--;
    mat<double> m2(n, 1);
    for (int i = 0; i < n; ++i) {
      m2.arr[i][0] = 0;
    }
    m2.arr[pt][0] = 1;
    for (int i = (int)matP.size() - 1; i >= 0; i--) {
      int p = (1 << i);
      if (s >= p) {
        s -= p;
        m2 = matP[i] * m2;
      }
    }
    double ans = 0;
    for (auto p : lines) {
      double res = 0;
      for (int x : p.second) {
        res += m2.arr[x][0];
      }
      res /= p.second.size();
      ans = max(ans, res);
    }
    printf("%.10f\n", ans);
  }
}
