/*
    Ingus Zemturis
    Gupa: 110
    Compiler: Visual Studio
*/
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Threading;

namespace PLAYGROUND
{
    internal class Program
    {
        static void Main()
        {
            //1.uzd <<<<<<<<<<<<<<<<<<<<<<<<<<<>>>>>>>>>>>>>>>>>>>>>>>>>
           int[,] ExtraNumbers =
            {
                { 1, 2, 3},
              { 4, 5, 6 }
            };

            for (int i = 0; i < ExtraNumbers.GetLength(0); i++)
            {
                for (int j = 0; j < ExtraNumbers.GetLength(1); j++)
                {
                    Console.Write($" {ExtraNumbers[i, j]}");
                }
                Console.WriteLine();
            }
            Console.WriteLine("\n");
            // 2.uzd <<<<<<<<<<<<<<<<<<<<<<<<<<<>>>>>>>>>>>>>>>>>>>>>>>>>
           int[][] NumbersExtra =
            {
                new int[] { 1, 2, 3 },
                new int[] { 4, 5 },
                new int[] { 6 }
            };

            for (int i = 0; i < NumbersExtra.GetLength(0); i++)
            {
                for (int j = 0; j < NumbersExtra[i].Length; j++)
                {
                    Console.Write($" {NumbersExtra[i][j]}");
                }
                Console.WriteLine();
            }
            Console.WriteLine("\n");
            // 3.uzd <<<<<<<<<<<<<<<<<<<<<<<<<<<>>>>>>>>>>>>>>>>>>>>>>>>>
            int[,] fourXfiveLegoBrick =
            {
                { 2, 4, 6, 8, 10},
                { 1, 2, 3, 4, 5},
                { 1, 3, 6, 10, 14},
                { 8, 7, 6, 5, 4}
            };
            int sum = 0;
            for (int i = 0; i < fourXfiveLegoBrick.GetLength(0); i++)
            {
                for (int j = 0; j < fourXfiveLegoBrick.GetLength(1); j++)
                {
                    sum += fourXfiveLegoBrick[i, j];
                }
                Console.WriteLine(sum);
                sum = 0;
            }
            Console.WriteLine("\n");
            // 4.uzd <<<<<<<<<<<<<<<<<<<<<<<<<<<>>>>>>>>>>>>>>>>>>>>>>>>>
            int WildNumber = 0;
            WildNumber = Convert.ToInt32(Console.ReadLine());

            int[][] kabucha =
            {
                new int[] {1, 2, 3},
                new int[] {15, 23, 125, 53, 66},
                new int[] {11, 22, 33, 44}
            };
            for (int i = 0; i < kabucha.GetLength(0); i++)
            {
                for (int j = 0; j < kabucha[i].Length; j++)
                {
                    if (WildNumber == kabucha[i][j])
                    {
                        Console.WriteLine($"Rinda index: {i} Kolona index: {j}");
                    }
                }
            }
            Console.WriteLine("\n");
            // 5.uzd <<<<<<<<<<<<<<<<<<<<<<<<<<<>>>>>>>>>>>>>>>>>>>>>>>>>
            int[][] deorst =
            {
                new int[] { 2, 5, 3, 4, 9 },
                new int[] { 11, 9, 7 },
                new int[] { 5, 3, 5, 3 }
            };

            for (int i = 0; i < deorst.GetLength(0); i++)
            {
                Array.Sort(deorst[i]);
            }

            for (int i = 0; i < deorst.GetLength(0); i++)
            {
                for (int j = 0; j < deorst[i].Length; j++)
                {
                    Console.Write($" {deorst[i][j]}");
                }
                Console.WriteLine();
            }
            Console.WriteLine("\n");
            // 6.uzd <<<<<<<<<<<<<<<<<<<<<<<<<<<>>>>>>>>>>>>>>>>>>>>>>>>>

            int[,] Reverse =
            {
                { 2, 4, 6, 8},
                { 10, 20, 30, 40},
                { 9, 7, 5, 3 }
            };
            int Xpoz = Reverse.GetLength(1);
            int Ypoz = Reverse.GetLength(0);
            int reversI = Ypoz;
            int[,] esreveR = new int[Xpoz, Ypoz];

            for (int i = 0; i < Ypoz; i++)
            {
                reversI--;
                for (int j = 0; j < Xpoz; j++)
                {
                    esreveR[j, reversI] = Reverse[i, j];
                }
            }
            for (int a = 0; a < esreveR.GetLength(0); a++)
            {
                for (int u = 0; u < esreveR.GetLength(1); u++)
                {
                    Console.Write($" {esreveR[a, u]}");
                }
                Console.WriteLine();
            }
        }
    }
}