using System;
					
public class Program
{
	public static void Main()
	{
			long k = Convert.ToInt64(Console.ReadLine());

            int[] velicine = new int[2001];

             velicine[250] = 10294254;
             velicine[500] = 82838504;
             velicine[750] = 280132754;
            velicine[1000] = 664677004;
            velicine[1250] = 1298971254;
            velicine[1477] = 2143731097;


            
            int pocetak = 0;
            int kraj = 0;

            velicine[0] = 4;
            
            velicine[1] = 8;
            velicine[2] = 22;
            int x = 1;
            int y = 2;

            if (k < velicine[250])
            {
                pocetak = 3;
                kraj = 250;
                
            }
            if(k < velicine[250] && k <velicine[500])
            {
                pocetak = 251;
                kraj = 500;
                
            }
            if (k < velicine[500] && k < velicine[750])
            {
                pocetak = 501;
                kraj = 750;
              
            }
            if (k < velicine[750] && k < velicine[1000])
            {
                pocetak = 751;
                kraj = 1000;
               
            }
            if (k < velicine[1000] && k < velicine[1250])
            {
                pocetak = 1001;
                kraj = 1250;
                
            }
            if (k < velicine[1250] && k < velicine[1477])
            {
                pocetak = 1251;
                
                kraj = 1477;
            }


            for (int i = 3; i < pocetak; i++)
            {
                
                x = x + y;
                y = y + 1;
            }
            int k1 = 0;
            for (int i = pocetak; i< kraj + 1; i++)
            {
                velicine[i] = velicine[i] + 9 + 4 * x;

                if (k < velicine[i])
                {
                    k1 = i;
                    goto End1;
                }

                x = x + y;
                y = y + 1;
            }
            End1:
            for(int j = 0; j<k1; j++)
            {
                Console.WriteLine("0 " + j);
                Console.WriteLine("1 " + j);
                Console.WriteLine("2 " + j);
                Console.WriteLine("3 " + j);
            }
            int ostatak = velicine[kraj] - velicine[k1];
            y = x;
            for (int l = 0; l <= ostatak; l = l + 2)
            {
                Console.WriteLine((2 + x) + " " + y);
                Console.WriteLine((3 + x) + " " + y);
                Console.WriteLine((4 + x) + " " + y);
                Console.WriteLine((2 + x) + " " + y+1);
                Console.WriteLine((3 + x) + " " + y+1);
                Console.WriteLine((4 + x) + " " + y+1);
                x = x + 5;
                y = y + 2;
            }
            if(ostatak%2 == 0)
            {
                Console.WriteLine((2 + x) + " " + y);
                Console.WriteLine((3 + x) + " " + y);
                Console.WriteLine((4 + x) + " " + y);
            }
	}
}