using System.Collections.Generic;
using System.Threading.Tasks;
namespace ArrayOneLineExample
static void Main(string[] args)
int rows = int.Parse(Console.ReadLine());
int cols = int.Parse(Console.ReadLine());
int[,] matrix = new int[rows, cols];
int[] minValues = new int[cols];
for (int row = 0; row < matrix.GetLength(0); row++)
int[] rowArray = Console.ReadLine().Split(' ').Select(int.Parse).ToArray();
for (int col = 0; col < matrix.GetLength(1); col++)
matrix[row, col] = rowArray[col];
for (int col = 0; col < matrix.GetLength(1); col++)
int minimum = matrix[0, col];
for (int row = 0; row < matrix.GetLength(0); row++)
if (matrix[row, col] < minimum)
minimum = matrix[row, col];
minValues[col] = minimum;
for (int row = 0; row < matrix.GetLength(0); row++)
for (int col = 0; col < matrix.GetLength(1); col++)
Console.Write("{0, 5}", matrix[row, col]);
for (int index = 0; index < minValues.Length; index++)
Console.Write("{0, 5}", minValues[index]);