#include <iostream>
#include <complex>
#include <vector>
#include <algorithm>
#include <cmath>
using namespace std;
const double EPS = 1e-8;
const double INF = 1e12;
#define EQ(n,m) (abs((n)-(m)) < EPS)
#define X real()
#define Y imag()
typedef complex<double> P;
typedef vector<P> VP;

bool solvable(vector<double> &r, vector<double> &rmin){
    sort(r.begin(), r.end());
    sort(rmin.begin(), rmin.end());
    int pt = 0;
    for(int i=0; i<(int)rmin.size(); i++, pt++){
        while(pt<(int)r.size() && rmin[i] > r[pt] +EPS){
            pt++;
        }
        if(pt == (int)r.size()) return false;
    }
    return true;
}

int main(){
    int n,m;
    cin >> n >> m;
    vector<double> r(n);
    for(int i=0; i<n; i++){
        cin >> r[i];
    }
    vector<VP> v(m);
    for(int i=0; i<m; i++){
        int size;
        cin >> size;
        v[i].resize(size);
        for(int j=0; j<size; j++){
            double x,y;
            cin >> x >> y;
            v[i][j] = P(x, y);
        }
    }

    vector<double> rmin(m, INF);
    for(int d=0; d<m; d++){
        int size = v[d].size();
        VP candp;
        vector<double> candr;
        for(int i=0; i<size; i++){
            for(int j=i+1; j<size; j++){
                for(int k=j+1; k<size; k++){
                    //3点を通る円
                    P p[3] = {v[d][i], v[d][j], v[d][k]};
                    double sin2[3];
                    for(int i=0; i<3; i++){
                        double a = abs(p[(i+1)%3] -p[(i+2)%3]);
                        double b = abs(p[i] -p[(i+1)%3]);
                        double c = abs(p[i] -p[(i+2)%3]);
                        double cosa = (b*b +c*c -a*a)/(2*b*c);
                        sin2[i] = sin(2*acos(cosa));
                    }
                    P center = (p[0]*sin2[0] +p[1]*sin2[1] +p[2]*sin2[2])
                        *(1/(sin2[0] +sin2[1] +sin2[2]));
                    candp.push_back(center);
                    candr.push_back(abs(center -p[0]));
                }
                //2点を直径とする円
                candp.push_back((v[d][i] +v[d][j])/2.0);
                candr.push_back(abs(v[d][i] -v[d][j])/2.0);
            }
        }
        for(int i=0; i<(int)candp.size(); i++){
            bool ok = true;
            for(int j=0; j<size; j++){
                if(abs(candp[i] -v[d][j]) > candr[i] +EPS){
                    ok = false;
                    break;
                }
            }
            if(ok){
                rmin[d] = min(rmin[d], candr[i]);
            }
        }
    }

    vector<bool> used(n, false);
    vector<int> ans(m, -1);
    bool ng = false;
    for(int i=0; i<m; i++){
        for(int j=0; j<n; j++){
            if(used[j]) continue;
            if(rmin[i] > r[j] +EPS) continue;
            vector<double> remr,remrmin;
            for(int k=0; k<n; k++){
                if(!used[k] && k!=j) remr.push_back(r[k]);
            }
            remrmin.insert(remrmin.end(), rmin.begin()+i+1, rmin.end());
            if(solvable(remr, remrmin)){
                ans[i] = j;
                used[j] = true;
                break;
            }
        }
        if(ans[i] == -1){
            ng = true;
            break;
        }
    }
    if(ng){
        cout << "NG" << endl;
    }else{
        for(int i=0; i<m; i++){
            cout << ans[i]+1 << endl;
        }
    }
    return 0;
}



Measured memory_bytes: 10128