#include <bits/stdc++.h>
using namespace std;
int main() {
freopen("P9118.in","w",stdout);
srand(time(0));
int n = rand() % 50000 + 1;
int m = rand() % 100 + 1;
int c = rand() % 10 + 1;
cout << n << " " << m << " " << c << endl;
for(int i=0; i<m; i++) {
int op = rand()%3 + 1;
if(op == 1 || op == 2) {
int x = rand() % n + 1;
int p = rand() % c + 1;
cout << op << " " << x << " " << p << endl;
} else {
int x = rand() % (n-1) + 2;
int y = (x == n) ? x-1 : x+1;
cout << op << " " << x << " " << y << endl;
}
}
return 0;
}