artem build new robot he matrix consist n row m column the cell locate ith row jth column leave value a_ij write if adjacent cell contain value robot break a matrix call good adjacent cell contain value cell call adjacent share Artem want increment value cell goodMore formally find good matrix b satisfie follow condition for valid ij b_ij a_ij b_ij a_ij1 for constraint problem show matrix b exist if table output please note minimize number increment