#include <fstream>
#include <vector>
#include <utility>
using namespace std;
const int NMAX = 20005;
vector <int> graph[NMAX];
int _move[NMAX];
bool done[NMAX];
void dfs(int node) {
if (done[node])
return ;
done[node] = true;
for (auto it: graph[node]) {
dfs(it);
if (!_move[it])
_move[node] = it;
}
}
int main()
{
ifstream cin("pioni.in");
ofstream cout("pioni.out");
int t = 0, n = 0, m = 0;
cin >> t >> n >> m;
int a, b;
while (m --) {
cin >> a >> b;
graph[a].push_back(b);
}
for (int i = 1; i <= n; ++ i)
dfs(i);
vector <pair <int, int> > sol;
sol.reserve(2 * NMAX);
while (t --) {
sol.clear();
int k = 0;
cin >> k;
int node;
while (k --) {
cin >> node;
if (_move[node])
sol.push_back(make_pair(node, _move[node]));
}
if (sol.empty())
cout << "Fumeanu\n";
else {
cout << "Nargy\n";
cout << sol.size();
for (auto it: sol)
cout << ' ' << it.first << ' ' << it.second;
cout << '\n';
}
}
cin.close();
cout.close();
return 0;
}