using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace work2
{
    class Program
    {
        static void Main(string[] args)
        {
            String[] teamAName = new String[3] { "A", "B", "C" };
            String[] teamBName = new String[3] { "X", "Y", "Z" };

            int[] pairMask = new int[3] { 6, 7, 2 };
            for (int rep = 3; rep-- != 0;)
            {
                for (int i = 0; i < 3; ++i)
                {
                    int m = pairMask[i];
                    if (m == 0) continue;
                    if ((m & (m - 1)) != 0) continue;

                    int b = -1;
                    for (int k = 0; k < 3; ++k)
                    {
                        pairMask[k] &= ~m;
                        if (m == (1 << k)) b = k;
                    }
                    Console.WriteLine("{0:s} : {1:s}", teamAName[i], teamBName[b]);
                    break;
                }
            }
        }
    }
}