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

namespace verseny2
{
    class Program
    {
        static void Main(string[] args)
        {
            string inp = Console.ReadLine();
            string in1 = null;
            string in2 = null;
            inp += ' ';
            int i = 0;
            while(inp[i] != ' ')
            {
                in1 += inp[i];
                i++;
            }
            i++;
            while (inp[i] != ' ')
            {
                in2 += inp[i];
                i++;
            }
            int N = Int32.Parse(in1);
            int A = Int32.Parse(in2);
            int[] P = new int[3];
            int[] M = new int[3];

            P[0] = A;
            M[0] = A - 2;
            P[1] = A;
            M[1] = A - 2;
            N -= P[0] + P[1] + M[0] + M[1];
            P[2] = N / 2 + 1;
            M[2] = N / 2 - 1;
            Console.WriteLine(P[0] + " " + M[0]);
            Console.WriteLine(P[1] + " " + M[1]);
            Console.WriteLine(P[2] + " " + M[2]);
            Console.ReadKey();
        }
    }
}

//92 10


//10 8
//10 8
//29 27