let input = [
[1,2,3,4,5],
[14,15,16,17,6],
[13,20,19,18,7],
[12,11,10,9,8],
]
function output (input){
let row = input.length;
let col = input[0].length;
let direction = 'right';
let res = [];
for(let i=0;i<col;i++){
for(let j=0;j<row;j++){
}
}
}