#include <iostream>
#include <iomanip>
#include <sstream>
#include <cstdio>
#include <string>
#include <vector>
#include <algorithm>
#include <complex>
#include <cstring>
#include <cstdlib>
#include <cmath>
#include <cassert>
#include <climits>
#include <queue>
#include <set>
#include <map>
#include <valarray>
#include <bitset>
#include <stack>
using namespace std;

#define REP(i,n) for(int i=0;i<(int)n;++i)
#define FOR(i,c) for(__typeof((c).begin())i=(c).begin();i!=(c).end();++i)
#define ALL(c) (c).begin(), (c).end()
typedef long long ll;
typedef pair<int,int> pii;
const int INF = 1<<29;
const double PI = acos(-1);
const double EPS = 1e-8;

typedef complex<double> P;
namespace std {
  bool operator < (const P& a, const P& b) {
    return real(a) != real(b) ? real(a) < real(b) : imag(a) < imag(b);
  }
}
double cross(const P& a, const P& b) {
  return imag(conj(a)*b);
}
double dot(const P& a, const P& b) {
  return real(conj(a)*b);
}
int ccw(P a, P b, P c) {
  b -= a; c -= a;
  if (cross(b, c) > 0)   return +1;       // counter clockwise
  if (cross(b, c) < 0)   return -1;       // clockwise
  if (dot(b, c) < 0)     return +2;       // c--a--b on line
  if (norm(b) < norm(c)) return -2;       // a--b--c on line
  return 0;
}

vector<P> graham(vector<P> v) {
  if (v.size()<=2) return v;
  int n = v.size(), k = 0;
  sort(ALL(v));
  vector<P> ret(2*n);
  for (int i = 0; i < n; ret[k++] = v[i++])
    while (k >= 2 && ccw(ret[k-2],ret[k-1],v[i]) < 0) k--;
  for (int i = n-2, t = k+1; i >= 0; ret[k++] = v[i--])
    while (k >= t && ccw(ret[k-2],ret[k-1],v[i]) < 0) k--;
  ret.resize(k-1);
  return ret;
}

typedef int Weight;
struct Edge {
  int src, dst;
  Weight weight;
  Edge(int src, int dst, Weight weight) :
    src(src), dst(dst), weight(weight) { }
  Edge(int src, int dst) : src(src), dst(dst) {}
};

bool operator < (const Edge &e, const Edge &f) {
  return e.weight != f.weight ? e.weight > f.weight : // !!INVERSE!!
    e.src != f.src ? e.src < f.src : e.dst < f.dst;
}

typedef vector<Edge> Edges;
typedef vector<Edges> Graph;

bool augment(const Graph& g, int u,
    vector<int>& matchTo, vector<bool>& visited) {
  if (u < 0) return true;
  FOR(e, g[u]) if (!visited[e->dst]) {
    visited[e->dst] = true;
    if (augment(g, matchTo[e->dst], matchTo, visited)) {
      matchTo[e->src] = e->dst;
      matchTo[e->dst] = e->src;
      return true;
    }
  }
  return false;
}

int bipartiteMatching(const Graph& g, int L, Edges& matching) {
  const int n = g.size();
  vector<int> matchTo(n, -1);
  int match = 0;
  REP(u, L) {
    vector<bool> visited(n);
    if (augment(g, u, matchTo, visited)) ++match;
  }
  REP(u, L) if (matchTo[u] >= 0) // make explicit matching
    matching.push_back( Edge(u, matchTo[u]) );
  return match;
}


double r[100];
double pr[100];

int n,m;
int ans[100];
bool used[100];

bool solve(int now) {
  if (now == m) return 1;
  Graph g(m+n);
  for (int i=now; i<m; ++i) {
    REP(j,n) {
      if (used[j]) continue;
      if (r[j]+EPS>=pr[i]) {
        g[i].push_back(Edge(i,m+j));
        g[m+j].push_back(Edge(m+j,i));
      }
    }
  }
  Edges es;
  int ret = bipartiteMatching(g,m,es);
  if (ret != m-now) return 0;

  REP(i,n) {
    if (!used[i] && pr[now]<=r[i]+EPS) {
      used[i] = 1;
      ans[now] = i;
      if (solve(now+1)) return 1;
      used[i] = 0;
    }
  }
  return 0;
}


int main() {
  while(cin>>n>>m) {
    REP(i,n) cin >> r[i];
    REP(i,m) {
      int p;
      cin >> p;
      
      pr[i] = 0;
      vector<P> ps(p);
      REP(j,p) {
        cin >> ps[j].real() >> ps[j].imag();
      }
      P o;
      double len = 100;
      REP(iter,1000) {
        double ma = 0;
        int id;
        REP(j,p) {
          if (ma < norm(ps[j]-o)) {
            ma = norm(ps[j]-o);
            id = j;
          }
        }
        o += (ps[id]-o)/abs(ps[id]-o)*P(len,0);
        len *= 0.95;
      }
      //cout << o << endl;
      //printf("%.10f\n",len);
      pr[i] = 0;
      REP(j,p) {
        pr[i] = max(pr[i], abs(ps[j]-o));
      }
      //cout << pr[i] << endl;
    }
    memset(used,0,sizeof(used));
    if (!solve(0)) {
      puts("NG");
    } else {
      REP(i,m) {
        cout << ans[i]+1 << endl;
      }
    }
  }
}

Measured memory_bytes: 8092