print matrix spirally and diagonally