// Praktiskais darbs 5
// Ralfs Emīls Saldnieks
// 110

using System;
class HelloWorld
{
    static void Main()
    {

        Console.WriteLine("1.UZD");

        int[,] skaitli =
        {
            { 12, 34, 435, 345 },
            { 32, 324, 34, 233 },
            { 324, 534, 345, 435}
        };

        for (int y = 0; y < 3; y++)
        {
            for (int x = 0; x < 4; x++)
            {
                Console.Write(skaitli[y, x] + "\t");
            }
            Console.WriteLine();
        }

        Console.WriteLine("2.UZD");

        int[][] masivs =
        {
            new int[] { 1, 2 },
            new int[] { 3, 232, 76 },
            new int[] { 54 }
        };

        for (int y = 0; y < masivs.Length; y++)
        {
            for (int x = 0; x < masivs[y].Length; x++)
            {
                Console.Write(masivs[y][x] + "\t");
            }
            Console.WriteLine();
        }

        Console.WriteLine("3.UZD");

        int[,] skaitli2 =
        {
            { 12, 34, 435, 345, 333 },
            { 32, 324, 34, 233, 32 },
            { 324, 534, 345, 435, 763 },
            { 5556, 98, 234, 324, 465}
        };

        for (int y = 0; y < 4; y++)
        {
            int sum = 0;
            for (int x = 0; x < 5; x++)
            {
                sum += skaitli2[y, x];
            }
            Console.WriteLine(sum);
        }

        Console.WriteLine("4.UZD");

        int[][] masivs2 =
        {
            new int[] { 1, 2 },
            new int[] { 3, 232, 76 },
            new int[] { 54 }
        };

        int ievads = Int32.Parse(Console.ReadLine());

        for (int y = 0; y < masivs2.Length; y++)
        {
            for (int x = 0; x < masivs2[y].Length; x++)
            {
                if (masivs2[y][x] == ievads)
                {
                    Console.WriteLine("y = " + y + " x = " + x);
                    break;
                }
            }
        }

        Console.WriteLine("5.UZD");
        
        int[][] masivs3 =
        {
            new int[] { 1, 2 },
            new int[] { 3, 232, 76 },
            new int[] { 54, 5 }
        };

        for (int y = 0; y < masivs3.Length; y++)
        {
            Array.Sort(masivs3[y]);
        }

        for (int y = 0; y < masivs3.Length; y++)
        {
            for (int x = 0; x < masivs3[y].Length; x++)
            {
                Console.Write(masivs3[y][x] + "\t");
            }
            Console.WriteLine();
        }

        Console.WriteLine("6.UZD");

        int[,] skaitli3 =
        {
            { 12, 34, 435, 345, 333 },
            { 32, 324, 34, 233, 32 },
            { 324, 534, 345, 435, 763 }
        };

        int rindas = skaitli3.GetLength(0);
        int kolonnas = skaitli3.GetLength(1);

        int[,] B = new int[kolonnas, rindas];

        for (int y = 0; y < rindas; y++)
        {
            for (int x = 0; x < kolonnas; x++)
            {
                B[x, y] = skaitli3[y, x];
            }
        }

        for (int y = 0; y < B.GetLength(0); y++)
        {
            for (int x = 0; x < B.GetLength(1); x++)
            {
                Console.Write(B[y, x] + "\t");
            }
            Console.WriteLine();
        }
    }
}