/* Freehold High School

 * Tad Cordle

 * School Code: 2100

 * Advisor: Mr. James Gill

 * Senior 5

 * ACSL Prints

 */

 

using System;

 

namespace C1_JG

{

    class Program

    {

        static void Main(string[] args)

        {

            for (int pancakemix = 1; pancakemix <= 5; pancakemix++)

            {

 

                Console.Write("Input: ");

                string[] input = Console.ReadLine().Replace(" ", "").Split(',');

                int top = int.Parse(input[0]) - 1;

                int bott = int.Parse(input[1]) - 1;

                bool[] fingers = new bool[10];

 

                for (int j = 1, i = 16; i >= 1; i /= 2,j += 2)

                {

                    if (top >= i)

                    {

                        top -= i;

                        fingers[j] = true;

                    }

                    if (bott >= i)

                    {

                        bott -= i;

                        fingers[j - 1] = true;

                    }

                }

 

                bool hasAny = false;

                for (int i = 0; i < 10; i++)

                    if (fingers[i])

                    {

                        Console.Write((i + 1).ToString() + " ");

                        hasAny = true;

                    }

                if (!hasAny)

                    Console.Write("None");

                Console.WriteLine();

 

            }

 

            Console.WriteLine();

            Console.Write("Press any key to continue...");

            Console.ReadKey(true);

        }

    }

}