![在这里插入图片描述](https://img-blog.csdnimg.cn/20200815075430145.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>
using namespace std;
int G[200][200];
int main()
{
int n, m; int t1, t2;
cin >> n >> m;
for (int i = 0; i < m; i++)
{
cin >> t1 >> t2;
G[t1][t2] = 1;
G[t2][t1] = 1;
}
int k,nk; cin >> k;
vector<int>v;
for (int i = 0; i < k; i++)
{
cin >> nk;
v.clear(); int isClique = 1, Maximal = 1,hasht[201] = { 0 };
for (int i = 0; i < nk; i++)
{
cin >> t1;
v.push_back(t1);
hasht[v[i]] = 1;
}
for (int i = 0; i < nk; i++)
{
if (isClique == 0) break;
for (int j = i+1; j < nk; j++)
{
if (G[v[i]][v[j]] == 0)
{
isClique = 0;
cout << "Not a Clique" << endl;
break;
}
}
}
if (isClique == 0) continue;
for (int i = 1; i <= n; i++)
{
if (hasht[i] == 0)
{
for (int l = 0; l < nk; l++)
{
if (G[v[l]][i] == 0) break;
if (l == nk - 1)
{
Maximal = 0;
}
}
}
if (Maximal == 0)
{
cout << "Not Maximal" << endl;
break;
}
}
if(Maximal)
cout << "Yes" << endl;
}
return 0;
}