#include <bits/stdc++.h>
using namespace std;
void solution();
int main() {
  solution();
  return 0;
}
constexpr double EPSILON = 1E-6;
vector<pair<double, double>> props[1000 * 1000 + 13];
double closestDistance2(const double x1, const double y1, const double x2,
                        const double y2, const double x3, const double y3) {
  const double x4 = x3 - x1, y4 = y3 - y1;
  const double x5 = x2 - x1, y5 = y2 - y1;
  const double d2 = x5 * x5 + y5 * y5;
  const double t = min(1.0, max(0.0, (x4 * x5 + y4 * y5) / d2));
  const double dx = x1 + t * x5 - x3;
  const double dy = y1 + t * y5 - y3;
  return dx * dx + dy * dy;
}
bool hitLine(const double x1, const double y1, const double dx1,
             const double dy1, const double x2, const double y2) {
  const double t = (y2 - y1) / dy1;
  return 0 <= t && t <= 1 && (x1 + t * dx1 - x2) >= 0;
}
bool collide(const vector<pair<double, double>>& points, const double x,
             const double y, const double r2) {
  const double x3 = x;
  const double y3 = y - EPSILON;
  int hits = 0;
  for (int i = 0; i < points.size(); ++i) {
    const int j = (i + 1) % points.size();
    const double x1 = points[i].first;
    const double y1 = points[i].second;
    const double x2 = points[j].first;
    const double y2 = points[j].second;
    if (closestDistance2(x1, y1, x2, y2, x, y) <= r2 + EPSILON) {
      return true;
    }
    if (hitLine(x1, y1, x2 - x1, y2 - y1, x3, y3)) {
      ++hits;
    }
  }
  return (hits % 2) == 1;
}
void solution() {
  double W, H;
  int N;
  scanf("%lf%lf%d", &W, &H, &N);
  vector<double> areas(N);
  for (int i = 0; i < N; ++i) {
    int M;
    scanf("%d", &M);
    props[i].resize(M);
    for (int j = 0; j < M; ++j) {
      double x, y;
      scanf("%lf%lf", &x, &y);
      props[i][j] = {x, y};
    }
    double area = props[i][M - 1].first * props[i][0].second -
                  props[i][0].first * props[i][M - 1].second;
    for (int j = 0; j < props[i].size() - 1; ++j) {
      int k = j + 1;
      area += props[i][j].first * props[i][k].second;
      area -= props[i][k].first * props[i][j].second;
    }
    areas[i] = area / 2;
  }
  int Q;
  scanf("%d", &Q);
  for (int q = 0; q < Q; ++q) {
    double x, y, r;
    scanf("%lf%lf%lf", &x, &y, &r);
    const double r2 = r * r;
    double area = 0;
    vector<int> ids;
    for (int i = 0; i < N; ++i) {
      if (collide(props[i], x, y, r2)) {
        ids.emplace_back(i);
        area += areas[i];
      }
    }
    printf("%.8lf %d", area, (int)ids.size());
    for (int id : ids) {
      printf(" %d", id);
    }
    printf("\n");
  }
}
