#include <bits/stdc++.h>
using namespace std;
#ifdef LOCAL
#include "debug.h"
#else
#define dbg(...) 47
#endif
mt19937 rng(time(0));
int f(int l, int r) {
return rng() % (r - l + 1) + l;
}
int main() {
ios::sync_with_stdio(false);
cin.tie(nullptr);
vector<vector<int>> a(4);
int x = 0;
for (int i = 0; i < 4; i++) {
for (int j = 0; j < 12; j++) {
a[i].push_back(x++);
}
}
int t = 100000;
while (t--) {
vector<int> x;
for (int i = 0; i < 12; i++) {
x.push_back(f(0, 49));
}
set<int> s(x.begin(), x.end());
if (s.size() != 12) continue;
bool ok = true;
for (int i = 0; i < a.size(); i++) {
for (int j = 0; j < 12; j++) {
if (a[i][j] == x[j]) {
ok = false;
break;
}
}
}
if (ok) {
a.push_back(x);
}
}
int n;
cin >> n;
for (int i = 0; i < n; i++) {
for (auto x : a[i]) {
cout << x << ' ';
}
cout << '\n';
}
return 0;
}