#include <iostream>
#include <algorithm>
using namespace std;

int main() {
    int n, c, d, e;
    int tabaci, strana;
    cin >> tabaci >> strana;
    
    int S = 1;
    int E = tabaci * 4;
    
    for(int i = 0; i < tabaci; i++) {
        
        
        if(strana == S) {
            cout << S + 1 << " " << E - 1 << " " << E << endl;
        }
        else if(strana == S + 1) {
            cout << S << " " << E - 1 << " " << E << endl;
        }
        else if(strana == E - 1) {
            cout << S << " " << S + 1 << " " << E << endl;
        }
        else if(strana == E) {
            cout << S << " " << S + 1 << " " << E - 1 << endl;
        }
        S += 2;
        E -= 2;
    }
    
    
    return 0;
}
