#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <climits>
#include <cfloat>
#include <ctime>
#include <cassert>
#include <map>
#include <utility>
#include <set>
#include <iostream>
#include <memory>
#include <string>
#include <vector>
#include <algorithm>
#include <functional>
#include <sstream>
#include <complex>
#include <stack>
#include <queue>
#include <numeric>
#include <list>
#include <iomanip>
#include <fstream>
   
using namespace std;
   

#define rep(i, n) for (int i = 0; i < (int)(n); ++i)
#define foreach(it, c) for (__typeof__((c).begin()) it=(c).begin(); it != (c).end(); ++it)
#define rforeach(it, c) for (__typeof__((c).rbegin()) it=(c).rbegin(); it != (c).rend(); ++it)
#define all(c) (c).begin(), (c).end()
#define rall(c) (c).rbegin(), (c).rend()
#define CL(arr, val) memset(arr, val, sizeof(arr))
#define COPY(dest, src) memcpy(dest, src, sizeof(dest))
#define ten(n) ((long long)(1e##n))
#define bin(n) (1LL << (n))

template <class T> void max_swap(T& a, const T& b) { a = max(a, b); }
template <class T> void min_swap(T& a, const T& b) { a = min(a, b); }

template <class T> void sort(vector<T>& c) { sort(c.begin(), c.end()); }
template <class T> void uniq(vector<T>& c) { sort(c.begin(), c.end()); c.erase(unique(c.begin(), c.end()), c.end()); }

template <class T> string to_s(const T& a) { ostringstream os; os << a; return os.str(); }
template <class T> T to_T(const string& s) { istringstream is(s); T res; is >> res; return res; }
  
template <class T, class U> ostream& operator<<(ostream& os, pair<T, U>& p) { os << "( " << p.first << ", " << p.second << " )"; return os; }
  
template <class T> void print(T a, int n, const string& deli = " ", int br = 1) { for (int i = 0; i < n; ++i) { cout << a[i]; if (i + 1 != n) cout << deli; } while (br--) cout << endl; }
template <class T> void print(const T& c, const string& deli = " ", int br = 1) { foreach (it, c) { cout << *it; if (++it != c.end()) cout << deli;--it; } while (br--) cout << endl; }
template <class T> void print2d(T a, int w, int h, int width = -1, int br = 1) { for (int i = 0; i < h; ++i) { for (int j = 0; j < w; ++j) {    if (width != -1) cout.width(width); cout << a[i][j] << ' '; } cout << endl; } while (br--) cout << endl; }
   
template <class T> void input(T& a, int n) { for (int i = 0; i < n; ++i) cin >> a[i]; }
template <class T> void input(T* a, int n) { for (int i = 0; i < n; ++i) cin >> a[i]; }

void fast_io() { cin.tie(0); ios::sync_with_stdio(false); }
#define trace(x) (cout << #x << ": " << (x) << endl)

bool valid(int x, int y, int w, int h) { return 0 <= x && x < w && 0 <= y && y < h; }


typedef long long ll;
typedef pair<int, int> pint;

const int dx[] = { 0, 1, 0, -1 };
const int dy[] = { 1, 0, -1, 0 };
  
const double PI = acos(-1.0);
const int mod = 1000000007;



#include <valarray>

typedef double number;
typedef valarray<number> point;
const int dim = 2;

number dot(const point& a, const point& b) {
  return (a * b).sum();
}
point cross(const point& a, const point& b) {
  return a.cshift(+1)*b.cshift(-1)
       - a.cshift(-1)*b.cshift(+1);
}
number dist2(const point& a, const point& b) {
  return dot(a-b, a-b);
}
struct min_ball {
  point center;
  number radius2;
  void add(const point& p) {
    ps.push_back(p);
  }
  void compile() {
    m = 0;
    center.resize(dim, 0);
    radius2 = -1;
    make_ball(ps.end());
  }
  template <class OUT>
  void support(OUT out) {
    copy(ps.begin(), supp_end, out);
  }
  min_ball() {
    for (int i = 0; i <= dim; ++i) {
      c[i].resize(dim, 0);
      v[i].resize(dim, 0);
    }
  }
private:
  list<point> ps;
  list<point>::iterator supp_end;
  int m;
  point v[dim+1], c[dim+1];
  number z[dim+1], r[dim+1];
  void pop() { --m; }
  void push(const point& p) {
    if (m == 0) {
      c[0] = p; r[0] = 0;
    } else {
      number e = dist2(p, c[m-1]) - r[m-1];
      point delta = p - c[0];
      v[m] = p - c[0];
      for (int i = 1; i < m; ++i)
        v[m] -= v[i] * dot(v[i], delta) / z[i];
      z[m] = dot(v[m], v[m]);
      c[m] = c[m-1] + e*v[m]/z[m]/2;
      r[m] = r[m-1] + e*e/z[m]/4;
    }
    center  = c[m];
    radius2 = r[m]; ++m;
  }
  void make_ball(list<point>::iterator i) {
    supp_end = ps.begin();
    if (m == dim + 1) return;
    for (list<point>::iterator k = ps.begin(); k != i; ) {
      list<point>::iterator j = k++;
      if (dist2(*j, center) > radius2) {
        push(*j); make_ball(j); pop();
        move_to_front(j);
      }
    }
  }
  void move_to_front(list<point>::iterator j) {
    if (supp_end == j) ++supp_end;
    ps.splice (ps.begin(), ps, j);
  }
};
double min_radius_sq()
{
    int p;
    cin >> p;
    min_ball s;
    while (p--)
    {
        point pt(2);
        cin >> pt[0] >> pt[1];
        s.add(pt);
    }
    s.compile();
    return s.radius2;
}


class BipatiteGraph
{
	vector<bool> used;

	bool _dfs(int v)
	{
		used[v] = true;
		for (int i = 0; i < edges[v].size(); ++i)
		{
			int u = edges[v][i];
			int k = match[u];
			if (k < 0 || !used[k] && _dfs(k))
			{
				match[v] = u;
				match[u] = v;
				return true;
			}
		}
		return false;
	}

public:
	int n, m;
	int vertices;
	vector<vector<int> > edges;
	vector<int> match;
    int matching;

	BipatiteGraph(int n, int m)
		: used(n + m), n(n), m(m), vertices(n + m), edges(n + m), match(n + m), matching(0)
	{
        clear();
	}

	void add_edge(int a, int b)
	{
		edges[a].push_back(b + n);
		edges[b + n].push_back(a);
	}

    void clear()
    {
		fill(match.begin(), match.end(), -1);
        matching = 0;
    }

	bool dfs(int v)
	{
		fill(used.begin(), used.end(), false);
		return _dfs(v);
	}

    int update_matching()
    {
        for (int i = 0; i < n; ++i)
            if (match[i] < 0 && dfs(i))
                ++matching;
        return matching;
    }

	int max_matching()
	{
		fill(match.begin(), match.end(), -1);
		int res = 0;
		for (int i = 0; i < n; ++i)
		{
			if (match[i] < 0)
			{
				if (dfs(i))
					++res;
			}
		}
		return res;
	}

    vector<pair<int, int> > matching_edges()
    {
        vector<pair<int, int> > edges;
        for (int i = 0; i < n; ++i)
            if (match[i] >= 0)
               edges.push_back(make_pair(i, match[i] - n));
        return edges;
    }
};
int main()
{
    int n, m, r[128];
    cin >> n >> m;
    rep(i, n)
    {
        cin >> r[i];
        r[i] = r[i] * r[i];
    }

    bool ok[128][128];
    rep(i, m)
    {
        double d = min_radius_sq();
        rep(j, n)
            ok[i][j] = d <= r[j] + 1e-9;
    }

    BipatiteGraph g(m, n);
    rep(i, m) rep(j, n)
        if (ok[i][j])
            g.add_edge(i, j);
    if (g.max_matching() < m)
    {
        cout << "NG" << endl;
        return 0;
    }

    bool used[128] = {};
    int match[128];
    rep(i, m)
    {
        rep(j, n)
        {
            if (!used[j] && ok[i][j])
            {
                used[j] = true;

                BipatiteGraph g(m, n);
                for (int p = i + 1; p < m; ++p)
                    rep(q, n)
                        if (!used[q] && ok[p][q])
                            g.add_edge(p, q);

                if (g.max_matching() == m - (i + 1))
                {
                    match[i] = j + 1;
                    break;
                }

                used[j] = false;
            }
        }
    }

    rep(i, m)
        cout << match[i] << endl;
}

Measured memory_bytes: 1432