1. 

/**
* Angewandte Mathematik, SS09, IFB 2C
* ACM Problem 10920 Spiral Tap
* Link: http://icpcres.ecs.baylor.edu/onlinejudge/index.php?option=com_onlinejudge&Itemid=8&category=21&page=show_problem&problem=1861
* @author Miesel Christoph
* @author Seilbeck Robert
* @author Wolfram Andre
* @version 1.0 20.04.2009
*
* Status : Accepted
* Runtime: 1.350
*/

import java.util.*;

public class SpiralTab
{
public static void main(String[] args)
{
Scanner sc = new Scanner(System.in);

while(sc.hasNext())
{

boolean bottomRight = false;
int size = sc.nextInt();
int index = sc.nextInt();
if(size == 0) break;
int col = size/2+1;
int row = col;
if(index < 4)
{
switch(index)
{
case 1: {System.out.println("Line = "+row+", column = "+col+"."); break;}
case 2: {System.out.println("Line = "+(row+1)+", column = "+col+"."); break;}
case 3: {System.out.println("Line = "+(row+1)+", column = "+(col-1)+"."); break;}
}
continue;
}

int cornerVar = 1;

int counter = 3;
int edda = 1;

while(counter < index)
{
edda++;
counter += 2*edda;
bottomRight = !bottomRight;
if(!bottomRight) cornerVar++;
}


int differenz = counter - index;

if(bottomRight)
{
if(differenz <= edda)
{
col -= differenz;
col += cornerVar;
row -= cornerVar;
}
if(differenz > edda)
{
col -= edda;
differenz -= edda;
row += differenz;
col += cornerVar;
row -= cornerVar;
}
}
else
{
if(differenz <= edda)
{
col += differenz;
col -= cornerVar;
row += cornerVar;
}
if(differenz > edda)
{
col += edda;
differenz -= edda;
row -= differenz;
col -= cornerVar;
row += cornerVar;
}
}


System.out.println("Line = "+row+", column = "+col+".");

}

}
}