![在这里插入图片描述](https://img-blog.csdnimg.cn/20200816175826901.png?x-oss-process=image/watermark,type_ZmFuZ3poZW5naGVpdGk,shadow_10,text_aHR0cHM6Ly9ibG9nLmNzZG4ubmV0L2Jid3FzYg==,size_16,color_FFFFFF,t_70#pic_center)
#include<iostream>
#include<vector>
#include<map>
#include<string>
#include<cstring>
#include<cstdio>
#include<algorithm>
#include<set>
#include<queue>
#include<unordered_map>
#include<cmath>
using namespace std;
const int maxn = 10001;
int main()
{
int n, m, t1, t2;
cin >> n >> m;
vector<int>v[maxn];
int a[maxn];
for (int i = 0; i < m; i++)
{
cin >> t1 >> t2;
v[t1].push_back(t2);
v[t2].push_back(t1);
}
int k; cin >> k;
for (int j = 0; j < k; j++)
{
set<int>s;
for (int i = 0; i < n; i++)
{
cin >> a[i];
s.insert(a[i]);
}
int flag = 1;
for (int q = 0; q < n; q++)
{
if (flag == 0)
break;
for (int i = 0; i < v[q].size(); i++)
{
if (a[q] == a[v[q][i]])
{
flag = 0;
break;
}
}
}
if (flag == 0)
cout << "No" << endl;
else
cout << s.size() << "-coloring" << endl;
}
}