#include <bits/stdc++.h>
using namespace std;
#define MIN_N 1700
#define MAX_N 1800
#define MIN_M 375
#define MAX_M 400
#define MIN_P 10
#define MAX_P 15
#define MIN_Q 20
#define MAX_Q 25
#define MIN_C 0
#define MAX_C 1000
#define MIN_A 1
#define MAX_A 5000
#define MIN_F 0
#define MAX_F 80
#define CONST 3
string SAMPLE[] =
{
"3 2 5",
"1",
"5 1 2 3 4 5",
"5 1 2 3 4 5",
"2",
"3 1 2 3",
"3 2 3 4",
"8",
"3 1 3 5",
"3 2 4 5",
"3",
"3 2",
"3 1 3 5",
"3 1 4 5",
"3 1",
"3 1 2 5",
"3 1 2 4",
"5 0",
"3 2 3 5",
"3 3 4 5"
};
int n, p, q, m;
vector < int > c;
vector < vector < vector < int > > > b;
vector < int > a;
vector < int > f;
vector < vector < vector < int > > > r;
vector < vector < bool > > w;
int rand_between(int low, int high) {
return low + rand() % (high - low + 1);
}
vector < int > rand_set(int c) {
set < int > s;
vector < int > p;
int t = max(1, (int) sqrt(rand_between(1, c * c / CONST))), x;
for (int i = 0; i < t; ++i) {
do {
x = rand_between(1, c);
}
while (s.find(x) != s.end());
s.insert(x);
p.push_back(x);
}
sort(p.begin(), p.end());
return p;
}
void gen() {
n = rand_between(MIN_N, MAX_N);
m = rand_between(MIN_M, MAX_M);
p = rand_between(MIN_P, MAX_P);
q = rand_between(MIN_Q, MAX_Q);
c.resize(n);
b.resize(n);
for (int i = 0; i < n; ++i) {
c[i] = rand_between(MIN_C, MAX_C);
b[i].resize(p);
for (int j = 0; j < p; ++j) {
b[i][j] = rand_set(q);
}
}
a.resize(m);
f.resize(m);
r.resize(m);
for (int i = 0; i < m; ++i) {
a[i] = rand_between(MIN_A, MAX_A);
f[i] = rand_between(MIN_F, MAX_F);
r[i].resize(p);
for (int j = 0; j < p; ++j) {
r[i][j] = rand_set(q);
}
}
}
void print() {
cout << n << ' ' << p << ' ' << q << endl;
for (int i = 0; i < n; ++i) {
cout << c[i] << endl;
for (int j = 0; j < p; ++j) {
cout << b[i][j].size();
for (int t = 0; t < b[i][j].size(); ++t)
cout << ' ' << b[i][j][t];
cout << endl;
}
}
cout << m << endl;
for (int i = 0; i < m; ++i) {
cout << a[i] << ' ' << f[i] << endl;
for (int j = 0; j < p; ++j) {
cout << r[i][j].size();
for (int t = 0; t < r[i][j].size(); ++t)
cout << ' ' << r[i][j][t];
cout << endl;
}
}
}
int main(int argc, char * argv[]) {
int seed = 0;
if (argc > 1) istringstream(argv[1]) >> seed;
srand(seed);
if (seed == 0) {
for(auto line : SAMPLE) cout << line << endl;
return 0;
}
gen();
print();
return 0;
}