import java.util.*;
public class Printer {
public int[] arrayPrint(int[][] arr, int n) {
// write code here
int[] ans = new int[n * n];
int i = 0;
for(int sy = n - 1; sy > -1; sy--) {
int x = 0, y = sy;
do {
ans[i++] = arr[x++][y++];
} while(y < n);
}
for(int sx = 1; sx < n; sx++) {
int x = sx, y = 0;
do {
ans[i++] = arr[x++][y++];
} while(x < n);
}
return ans;
}
}