#include <iostream> #include <conio.h> using namespace std; bool isPoint(int x1, int y1, int x2, int y2, int x3, int y3, int x4, int y4) { if( ((x1==x3)&&(y1==y3)) || ((x1==x3)&&(y2==y4)) || ((x2==x4)&&(y1==y3)) || ((x2==x4)&&(y2==y4))) { return true; } if( ((x1==x4)&&(y1==y4)) || ((x1==x3)&&(y2==y3)) || ((x2==x3)&&(y2==y3)) || ((x2==x4)&&(y1==y4))) { return true; } return false; } bool isLine(int x1, int y1, int x2, int y2, int x3, int y3, int x4, int y4) { if(x2>x1) { for(int x=x1+1;x<x2;x++) { if( ((x==x3)&&(y1==y3)) || ((x==x3)&&(y1==y4)) || ((x==x4)&&(y1==y3)) || ((x==x4)&&(y1==y4))) { return true; } if( ((x==x3)&&(y2==y3)) || ((x==x3)&&(y2==y4)) || ((x==x4)&&(y2==y3)) || ((x==x4)&&(y2==y4))) { return true; } } } else { for(int x=x2+1;x<x1;x++) { if( ((x==x3)&&(y1==y3)) || ((x==x3)&&(y1==y4)) || ((x==x4)&&(y1==y3)) || ((x==x4)&&(y1==y4))) { return true; } if( ((x==x3)&&(y2==y3)) || ((x==x3)&&(y2==y4)) || ((x==x4)&&(y2==y3)) || ((x==x4)&&(y2==y4))) { return true; } } } if(y2>y1) { for(int y=y1+1;y<y2;y++) { if( ((x1==x3)&&(y==y3)) || ((x1==x3)&&(y==y4)) || ((x1==x4)&&(y==y3)) || ((x1==x4)&&(y==y4))) { return true; } if( ((x2==x3)&&(y==y3)) || ((x2==x3)&&(y==y4)) || ((x2==x4)&&(y==y3)) || ((x2==x4)&&(y==y4))) { return true; } } } else { for(int y=y2+1;y<y1;y++) { if( ((x1==x3)&&(y==y3)) || ((x1==x3)&&(y==y4)) || ((x1==x4)&&(y==y3)) || ((x1==x4)&&(y==y4))) { return true; } if( ((x2==x3)&&(y==y3)) || ((x2==x3)&&(y==y4)) || ((x2==x4)&&(y==y3)) || ((x2==x4)&&(y==y4))) { return true; } } } return false; } bool isRectangle(int x1, int y1, int x2, int y2, int x3, int y3, int x4, int y4) { if(x2>x1) { for(int x=x1+1;x<x2;x++) { if(y2>y1) { for(int y=y1+1;y<y2;y++) { if( ((x==x3)&&(y==y3)) || ((x==x3)&&(y==y4)) || ((x==x4)&&(y==y3)) || ((x==x4)&&(y==y4))) { return true; } } } else { for(int y=y2+1;y<y1;y++) { if( ((x==x3)&&(y==y3)) || ((x==x3)&&(y==y4)) || ((x==x4)&&(y==y3)) || ((x==x4)&&(y==y4))) { return true; } } } } } else { for(int x=x2+1;x<x1;x++) { if(y2>y1) { for(int y=y1+1;y<y2;y++) { if( ((x==x3)&&(y==y3)) || ((x==x3)&&(y==y4)) || ((x==x4)&&(y==y3)) || ((x==x4)&&(y==y4))) { return true; } } } else { for(int y=y2+1;y<y1;y++) { if( ((x==x3)&&(y==y3)) || ((x==x3)&&(y==y4)) || ((x==x4)&&(y==y3)) || ((x==x4)&&(y==y4))) { return true; } } } } } return false; } int main() { int t; int x1,x2,x3,x4,y1,y2,y3,y4; cin>>t; for(int i=1;i<=t;i++) { cin>>x1>>y1>>x2>>y2>>x3>>y3>>x4>>y4; if(isRectangle(x1,y1,x2,y2,x3,y3,x4,y4)==true) cout<<"rectangle"<<endl; else { if(isLine(x1,y1,x2,y2,x3,y3,x4,y4)==true) { cout<<"line"<<endl; } else { if(isPoint(x1,y1,x2,y2,x3,y3,x4,y4)==true) { cout<<"point"<<endl; } else { cout<<"nothing"<<endl; } } } } getch(); return 0; }