#include <bits/stdc++.h>
using namespace std;
const int maxn = 1e6 + 5;
const long double eps = 1e-4;
int dcmp(long double k) { return (k >= eps) - (k <= -eps); }
int cnt[maxn];
struct Vec {
  long double x, y;
  Vec() {}
  Vec(long double a, long double b) : x(a), y(b) {}
  Vec operator+(const Vec &t) const { return Vec(x + t.x, y + t.y); }
  Vec operator-(const Vec &t) const { return Vec(x - t.x, y - t.y); }
  Vec operator*(long double t) const { return Vec(x * t, y * t); }
  const bool operator==(const Vec &t) const {
    return (dcmp(t.x - x) == 0 && dcmp(y - t.y) == 0);
  }
};
vector<Vec> poly[maxn];
struct Cir {
  Vec p;
  long double r;
  Cir() {}
  Cir(Vec a, long double b) { p = a, r = b; }
} query;
long double len(Vec a) { return sqrt(a.x * a.x + a.y * a.y); }
long double dot(Vec a, Vec b) { return a.x * b.x + a.y * b.y; }
long double cro(Vec a, Vec b) { return a.x * b.y - a.y * b.x; }
long double val[maxn];
long double Area(vector<Vec> p, int sum) {
  long double s = 0;
  for (int i = 1; i <= sum; i++) s += cro(p[i - 1], p[i]);
  return abs(s / 2.0);
}
struct line {
  Vec from, to;
  line(){};
  line(Vec a, Vec b) : from(a), to(b){};
};
long double PL_dist(Vec a, line b) {
  if (b.from == b.to) return len(a - b.to);
  Vec v1 = b.to - b.from, v2 = a - b.from, v3 = a - b.to;
  if (dcmp(dot(v1, v2)) < 0)
    return len(v2);
  else if (dcmp(dot(v1, v3)) > 0)
    return len(v3);
  return abs(cro(v1, v2)) / len(v1);
}
bool Pan_PL(Vec p, Vec a, Vec b) {
  return (dcmp(cro(p - a, b - a)) == 0 && dcmp(dot(p - a, p - b)) <= 0);
}
int P_in_Poly(Vec p, vector<Vec> poly, int sum) {
  int cnt = 0;
  for (int i = 1; i <= sum; i++) {
    if (Pan_PL(p, poly[i], poly[i - 1])) return 1;
    if (dcmp(p.y - min(poly[i].y, poly[i - 1].y)) >= 0 &&
        dcmp(max(poly[i].y, poly[i - 1].y) - p.y) > 0) {
      long double tem = poly[i - 1].x + (p.y - poly[i - 1].y) /
                                            (poly[i].y - poly[i - 1].y) *
                                            (poly[i].x - poly[i - 1].x);
      cnt += (dcmp(tem - p.x) > 0);
    }
  }
  return cnt & 1;
}
int main() {
  long double w, h;
  int n;
  cin >> w >> h >> n;
  for (int i = 0; i < n; i++) {
    cin >> cnt[i];
    for (int j = 0; j < cnt[i]; j++) {
      long double x, y;
      scanf("%Lf%Lf", &x, &y);
      poly[i].push_back(Vec(x, y));
    }
    poly[i].push_back(poly[i][0]);
    val[i] = Area(poly[i], cnt[i]);
  }
  int q;
  cin >> q;
  while (q--) {
    scanf("%Lf%Lf%Lf", &query.p.x, &query.p.y, &query.r);
    long double ans = 0;
    vector<int> rec;
    for (int i = 0; i < n; i++) {
      long double minn = 1e18;
      for (int j = 0; j < cnt[i]; j++)
        minn = min(minn, PL_dist(query.p, line(poly[i][j], poly[i][j + 1])));
      if (dcmp(query.r - minn) >= 0 || P_in_Poly(query.p, poly[i], cnt[i])) {
        rec.push_back(i);
        ans += val[i];
      }
    }
    cout << fixed << setprecision(6) << ans;
    cout << " " << rec.size();
    for (auto &e : rec) {
      cout << " " << e;
    }
    puts("");
  }
  return 0;
}
