#include<cstdio>
using namespace std;
int a[100],b[100],c[100],d[100];
bool dist1(int i, int j)//point i,j distance 1?
{
	int aa=a[i]-a[j],bb=b[i]-b[j],cc=c[i]-c[j],dd=d[i]-d[j];
	if (aa*bb+cc*dd!=0) return 0;
	if (3*aa*aa+11*bb*bb+cc*cc+33*dd*dd==144) return 1;
	return 0;
}
bool dist2(int i, int j)//point i,j distance 2?
{
	int aa=a[i]-a[j],bb=b[i]-b[j],cc=c[i]-c[j],dd=d[i]-d[j];
	if (aa*bb+cc*dd!=0) return 0;
	if (3*aa*aa+11*bb*bb+cc*cc+33*dd*dd==576) return 1;
	return 0;
}
bool ell3(int i, int j, int k)//point i,j,k form ell3, with j being the midpoint?
{
    return dist1(i,j)&&dist1(j,k)&&dist2(k,i);
}
bool equ1(int i, int j, int k)//point i,j,k form equilateral triangle of length 1?
{
	return dist1(i,j)&&dist1(j,k)&&dist1(k,i);
}
bool equ2(int i, int j, int k)//point i,j,k form equilateral triangle of length 2?
{
	return dist2(i,j)&&dist2(j,k)&&dist2(k,i);
}
int main()
{
	int i,j,k; 
	for (i=0;i<=55;i++) scanf("%d %d %d %d,",&a[i],&b[i],&c[i],&d[i]);
	for (i=0;i<=1;i++) printf("p.add_constraint(w[%d] == 0)\n",i);
	for (i=2;i<=3;i++) printf("p.add_constraint(w[%d] == 1)\n",i);
	for (i=4;i<=55;i++)
	   printf("p.add_constraint(w[%d] <= 1)\n",i);
	for (i=0;i<=55;i++)
	  for (j=i+1;j<=55;j++)
	      for (k=j+1;k<=55;k++)
	        if (equ1(i,j,k)||equ2(i,j,k))
	          {
	          	printf("p.add_constraint(w[%d]+w[%d]+w[%d]>=1)\n",i,j,k);
		        printf("p.add_constraint(w[%d]+w[%d]+w[%d]<=2)\n",i,j,k);
	          }
    for (j=0;j<=55;j++)
	  for (i=0;i<=55;i++)
	      for (k=i+1;k<=55;k++)
	        if (ell3(i,j,k))
	          {
	          	printf("p.add_constraint(w[%d]+w[%d]+w[%d]>=1)\n",i,j,k);
		        printf("p.add_constraint(w[%d]+w[%d]+w[%d]<=2)\n",i,j,k);
	          }
}
