//	biatris.txt

string getNameA(n){
	if(n<0)return "0";
	p=('z'-'a')+1;
	name="";
	do{
		t=n%p;
		if(n<p && name.length())--t;
		name=(string)('a'+t)+name;
		n=(int)(n/p);
		}while(n);
	return name;
}



//--------------------------------------------------------------------------------------------------
//vidno ho sovpal s grupoi xotjabe odin row
var Vidno1(p_table,nrow){
	p_main=&(*p_table)["body"][0];
	sizetable=p_main->size();
	groop=(vector)(set)(*p_main);
	p_row=&(*p_table)["body"][nrow];
	R={};
	for(i=0;i<groop.size();++i){
		stan=0;
		one=0;
		for(j=0;j<sizetable;++j)if((*p_main)[j]==groop[i]){
			if(!stan){
				one=(*p_row)[j];
				stan=1;
				}else if(one!=(*p_row)[j]){
					stan=2;
					break;
					}
			}
		if(stan==1)R.push(one);
		}
	return R;
}



var overallType(p_table,nrow){
	p_row=&(*p_table)["body"][nrow];
	sizetable=p_row->size();
	type=typeof((*p_row)[0]);
	for(i=1;i<sizetable;++i)if(type!=typeof((*p_row)[i]))break;
	if(i<sizetable)return #;
	return type;
}



var getSizeVectorRowOK(p_table,nrow){
	p_row=&(*p_table)["body"][nrow];
	sizetable=p_row->size();
	size=-1;
	for(i=0;i<sizetable;++i){
		if(size==-1)size=(*p_row)[i].size();
		if(size>=0 && size!=(*p_row)[i].size())size=-2;
		}
	if(size>=0)return size;
	return -1;
}



void addNumbersRowVectorSize(p_table,nrow){
	p_row=&(*p_table)["body"][nrow];
	sizetable=p_row->size();
	newRow={};
	for(i=0;i<sizetable;++i)newRow.push((*p_row)[i].size());
	(*p_table)["body"].push(newRow);
}



void rozadresovkaRowVector(p_table,nrow){
	p_row=&(*p_table)["body"][nrow];
	sizetable=p_row->size();
	sizeRow=(*p_row)[0].size();
	for(j=0;j<sizeRow;++j){
		newRow={};
		for(i=0;i<sizetable;++i)newRow.push((*p_row)[i][j]);
		(*p_table)["body"].push(newRow);
		}
}



var Biatris(table){
	p_table=&table;
	nrow=1;
	while((*p_table)["body"].size()>nrow){
		type=overallType(p_table,nrow);
		if(type=="vector"){
			n=getSizeVectorRowOK(p_table,nrow);
			if(n<0)addNumbersRowVectorSize(p_table,nrow);
				else rozadresovkaRowVector(p_table,nrow);
			}
		++nrow;
		}
	//trace((*p_table)["body"].size());
	//R=Vidno1(p_table,1);
	//trace(R);

}


//	biatris.txt	:-|