#include <iostream>
using namespace std;
class quee {
int f;
int b;
int* arr;
public:
quee(int n) {
f = 0;
b = -1;
arr = new int[n];
}
void push(int n) {
arr[++b] = n;
}
int pop() {
if (empty()) return -1;
return arr[f++];
}
int size() {
return b - f + 1;
}
int empty() {
return (b - f) == -1;
}
~quee() {
delete[] arr;
}
};
int main(void)
{
ios_base::sync_with_stdio(false); cin.tie(NULL);
int n, limit;
cin >> n >> limit;
quee q(n * n);
for (int i = 1; i <= n; i++) q.push(i);
cout << "<";
while (q.size() != 1)
{
for (int i = 0; i < limit - 1; i++)
q.push(q.pop());
cout << q.pop() << ", ";
}
cout << q.pop() << ">";
return 0;
}
I2luY2x1ZGUgPGlvc3RyZWFtPgoKdXNpbmcgbmFtZXNwYWNlIHN0ZDsKCmNsYXNzIHF1ZWUgewoJaW50IGY7CglpbnQgYjsKCWludCogYXJyOwpwdWJsaWM6CglxdWVlKGludCBuKSB7CgkJZiA9IDA7CgkJYiA9IC0xOwoJCWFyciA9IG5ldyBpbnRbbl07Cgl9Cgl2b2lkIHB1c2goaW50IG4pIHsKCQlhcnJbKytiXSA9IG47Cgl9CglpbnQgcG9wKCkgewoJCWlmIChlbXB0eSgpKSByZXR1cm4gLTE7CgkJcmV0dXJuIGFycltmKytdOwoJfQoJaW50IHNpemUoKSB7CgkJcmV0dXJuIGIgLSBmICsgMTsKCX0KCWludCBlbXB0eSgpIHsKCQlyZXR1cm4gKGIgLSBmKSA9PSAtMTsKCX0KCX5xdWVlKCkgewoJCWRlbGV0ZVtdIGFycjsKCX0KfTsKaW50IG1haW4odm9pZCkKewoJaW9zX2Jhc2U6OnN5bmNfd2l0aF9zdGRpbyhmYWxzZSk7IGNpbi50aWUoTlVMTCk7CglpbnQgbiwgbGltaXQ7CgljaW4gPj4gbiA+PiBsaW1pdDsKCglxdWVlIHEobiAqIG4pOwoJZm9yIChpbnQgaSA9IDE7IGkgPD0gbjsgaSsrKSBxLnB1c2goaSk7Cgljb3V0IDw8ICI8IjsKCXdoaWxlIChxLnNpemUoKSAhPSAxKQoJewoJCWZvciAoaW50IGkgPSAwOyBpIDwgbGltaXQgLSAxOyBpKyspCgkJCXEucHVzaChxLnBvcCgpKTsKCQljb3V0IDw8IHEucG9wKCkgPDwgIiwgIjsKCX0KCWNvdXQgPDwgcS5wb3AoKSA8PCAiPiI7CglyZXR1cm4gMDsKfQ==