print matrix diag or spiral