function cal(y,m) {
const t = v => ~~ v;
const l = y%4;
const r = [];
let c=(t(23*m/9)+(m<3?y--:y-2)+5+t(y/4)-t(y/100)+t(y/400))%7;
const e = 29+(62648012+16*!l>>m*2&3);
for(let d =1, w = 0; d < e; ++d){
if(!r[w]) {
r[w] = [,,,,,,,];
}
r[w][c]=d;
c = ++c%7;
w += !c;
}
return r;
}