/* aff_2nd v1.0.0 Ver.: OK (c) 03/10 - Christos Iosifides */
/*
   This program builds A and B arrays for the 2nd degree affine transformation

   Name:			aff_2nd
   Version:		    1.0.0
   Copyright:	    Ch Iossif @ 2010
   Author:		    Christos Iosifidis
   Date:			12/03/10 20:30
   Modified:		12/03/10 20:30 - 22:54
   Description:     Builds A and B arrays for the 2nd degree affine transformation
   Compile:
            Linux:     gcc aff_2nd.c -o aff_2nd
            Windows:   gcc aff_2nd.c -o aff_2nd.exe or similar with any ANSI C compiler

  INPUT:

15
131.493   147.761  363786.7197482 4027455.6496175
113.184   138.209  310434.4848630 4065680.4228670
 77.399   112.584  220846.7654594 4170624.1152790
 30.976    58.104  129410.0397519 4414044.5777538
133.926    59.020  495427.0806983 4420765.8943601
157.035    84.320  541952.3297973 4314595.2715258
158.770   117.107  502360.9785390 4166402.9476451
 98.660    48.275  386104.5315789 4468419.0613262
102.326    45.557  399649.8186839 4481185.8836550
116.072    73.846  408828.0046097 4350263.9301557
116.670    98.748  376611.1105263 4235708.0884211
 56.103    73.028  196619.3565982 4346227.4609688
 74.232    36.571  314353.5994996 4514909.6228281
 44.549    69.043  165857.1631579 4362919.9305263
 79.610    96.336  249927.0847823 4242710.4221900

  OUTPUT:

30 12
132340777465.1554079 16220399009635.9189281  363786.7197482 4027455.6496175 1465134879705.7062470       1.0000000       0.0000000       0.0000000       0.0000000       0.0000000       0.0000000       0.0000000
      0.0000000       0.0000000       0.0000000       0.0000000       0.0000000       0.0000000 132340777465.1554079 16220399009635.9189281  363786.7197482 4027455.6496175 1465134879705.7062470       1.0000000
96369569392.1561761 16529757300883.9879360  310434.4848630 4065680.4228670 1262127407690.3011506       1.0000000       0.0000000       0.0000000       0.0000000       0.0000000       0.0000000       0.0000000
      0.0000000       0.0000000       0.0000000       0.0000000       0.0000000       0.0000000 96369569392.1561761 16529757300883.9879360  310434.4848630 4065680.4228670 1262127407690.3011506       1.0000000
48773293813.8792329 17394105510946.7414818  220846.7654594 4170624.1152790 921068845806.3389410       1.0000000       0.0000000       0.0000000       0.0000000       0.0000000       0.0000000       0.0000000
      0.0000000       0.0000000       0.0000000       0.0000000       0.0000000       0.0000000 48773293813.8792329 17394105510946.7414818  220846.7654594 4170624.1152790 921068845806.3389410       1.0000000
16746958388.5883382 19483789534397.7225361  129410.0397519 4414044.5777538 571221684273.7779084       1.0000000       0.0000000       0.0000000       0.0000000       0.0000000       0.0000000       0.0000000
      0.0000000       0.0000000       0.0000000       0.0000000       0.0000000       0.0000000 16746958388.5883382 19483789534397.7225361  129410.0397519 4414044.5777538 571221684273.7779084       1.0000000
245447992289.2398604 19543171092737.4548340  495427.0806983 4420765.8943601 2190167141493.4336356       1.0000000       0.0000000       0.0000000       0.0000000       0.0000000       0.0000000       0.0000000
      0.0000000       0.0000000       0.0000000       0.0000000       0.0000000       0.0000000 245447992289.2398604 19543171092737.4548340  495427.0806983 4420765.8943601 2190167141493.4336356       1.0000000
293712327772.7214254 18615732357072.7918262  541952.3297973 4314595.2715258 2338304959535.8215034       1.0000000       0.0000000       0.0000000       0.0000000       0.0000000       0.0000000       0.0000000
      0.0000000       0.0000000       0.0000000       0.0000000       0.0000000       0.0000000 293712327772.7214254 18615732357072.7918262  541952.3297973 4314595.2715258 2338304959535.8215034       1.0000000
252366552758.6616186 17358913522145.7778921  502360.9785390 4166402.9476451 2093038261766.7664218       1.0000000       0.0000000       0.0000000       0.0000000       0.0000000       0.0000000       0.0000000
      0.0000000       0.0000000       0.0000000       0.0000000       0.0000000       0.0000000 252366552758.6616186 17358913522145.7778921  502360.9785390 4166402.9476451 2093038261766.7664218       1.0000000
149076709305.7617873 19966768907623.3183174  386104.5315789 4468419.0613262 1725276848571.5804837       1.0000000       0.0000000       0.0000000       0.0000000       0.0000000       0.0000000       0.0000000
      0.0000000       0.0000000       0.0000000       0.0000000       0.0000000       0.0000000 149076709305.7617873 19966768907623.3183174  386104.5315789 4468419.0613262 1725276848571.5804837       1.0000000
159719977574.0741455 20081026923868.8431969  399649.8186839 4481185.8836550 1790905125891.5729506       1.0000000       0.0000000       0.0000000       0.0000000       0.0000000       0.0000000       0.0000000
      0.0000000       0.0000000       0.0000000       0.0000000       0.0000000       0.0000000 159719977574.0741455 20081026923868.8431969  399649.8186839 4481185.8836550 1790905125891.5729506       1.0000000
167140337353.1488844 18924796262013.7170868  408828.0046097 4350263.9301557 1778509722091.1061584       1.0000000       0.0000000       0.0000000       0.0000000       0.0000000       0.0000000       0.0000000
      0.0000000       0.0000000       0.0000000       0.0000000       0.0000000       0.0000000 167140337353.1488844 18924796262013.7170868  408828.0046097 4350263.9301557 1778509722091.1061584       1.0000000
141835928571.8529547 17941223010315.9290943  376611.1105263 4235708.0884211 1595214727045.5017853       1.0000000       0.0000000       0.0000000       0.0000000       0.0000000       0.0000000       0.0000000
      0.0000000       0.0000000       0.0000000       0.0000000       0.0000000       0.0000000 141835928571.8529547 17941223010315.9290943  376611.1105263 4235708.0884211 1595214727045.5017853       1.0000000
38659171389.0901339 18889693142479.3019276  196619.3565982 4346227.4609688 854552447005.1138592       1.0000000       0.0000000       0.0000000       0.0000000       0.0000000       0.0000000       0.0000000
      0.0000000       0.0000000       0.0000000       0.0000000       0.0000000       0.0000000 38659171389.0901339 18889693142479.3019276  196619.3565982 4346227.4609688 854552447005.1138592       1.0000000
98818185518.3549174 20384408902305.7761993  314353.5994996 4514909.6228281 1419278091351.3946409       1.0000000       0.0000000       0.0000000       0.0000000       0.0000000       0.0000000       0.0000000
      0.0000000       0.0000000       0.0000000       0.0000000       0.0000000       0.0000000 98818185518.3549174 20384408902305.7761993  314353.5994996 4514909.6228281 1419278091351.3946409       1.0000000
27508598570.7862611 19035070320183.6144199  165857.1631579 4362919.9305263 723621522762.1542720       1.0000000       0.0000000       0.0000000       0.0000000       0.0000000       0.0000000       0.0000000
      0.0000000       0.0000000       0.0000000       0.0000000       0.0000000       0.0000000 27508598570.7862611 19035070320183.6144199  165857.1631579 4362919.9305263 723621522762.1542720       1.0000000
62463547707.7789722 18000591726559.6480427  249927.0847823 4242710.4221900 1060368247393.4279572       1.0000000       0.0000000       0.0000000       0.0000000       0.0000000       0.0000000       0.0000000
      0.0000000       0.0000000       0.0000000       0.0000000       0.0000000       0.0000000 62463547707.7789722 18000591726559.6480427  249927.0847823 4242710.4221900 1060368247393.4279572       1.0000000
    131.4930000
    147.7610000
    113.1840000
    138.2090000
     77.3990000
    112.5840000
     30.9760000
     58.1040000
    133.9260000
     59.0200000
    157.0350000
     84.3200000
    158.7700000
    117.1070000
     98.6600000
     48.2750000
    102.3260000
     45.5570000
    116.0720000
     73.8460000
    116.6700000
     98.7480000
     56.1030000
     73.0280000
     74.2320000
     36.5710000
     44.5490000
     69.0430000
     79.6100000
     96.3360000
*/
#include <stdio.h>
#include <stdlib.h>

#define sqr(x) ((x)*(x))

void gpl(void) {
    puts("\nCopyright (C) March 2009 Ch Iossif <chiossif@yahoo.com>");

    puts("\nThis program is free software: you can redistribute it and/or modify");
    puts("it under the terms of the GNU General Public License as published by");
    puts("the Free Software Foundation, either version 3 of the License, or");
    puts("(at your option) any later version.");

    puts("\nThis program is distributed in the hope that it will be useful,");
    puts("but WITHOUT ANY WARRANTY; without even the implied warranty of");
    puts("MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the");
    puts("GNU General Public License for more details.");

    puts("\nYou should have received a copy of the GNU General Public License");
    puts("along with this program.  If not, see <http://www.gnu.org/licenses/>.\n");
}

int main(void) {
    int n;
    long double *x,*y,*xx,*yy;
    register int i,j;

    scanf("%d",&n);
    if ((x=malloc(n*sizeof(long double)))==NULL)
        exit(1);
    if ((y=malloc(n*sizeof(long double)))==NULL)
        exit(1);
    if ((xx=malloc(n*sizeof(long double)))==NULL)
        exit(1);
    if ((yy=malloc(n*sizeof(long double)))==NULL)
        exit(1);
    for (i=0;i<n;i++)
        if (scanf("%Lf %Lf %Lf %Lf",&xx[i],&yy[i],&x[i],&y[i])!=4)
            exit(1);
    /*
        printf("\nINPUT :\n");
        printf("N = %d\n",n);
        for (i=0;i<n;i++)
            printf("%12.3Lf %12.3Lf %12.3Lf %12.3Lf\n",xx[i],yy[i],x[i],y[i]);

        printf("\nOUTPUT :\n");
    */
    printf("%d 12\n",2*n);
    for (i=0;i<n;i++) {
        printf("%15.7Lf %15.7Lf %15.7Lf %15.7Lf %15.7Lf %15.7Lf %15.7Lf %15.7Lf %15.7Lf %15.7Lf %15.7Lf %15.7Lf\n",sqr(x[i]),sqr(y[i]),x[i],y[i],x[i]*y[i],1.0L,0.0L,0.0L,0.0L,0.0L,0.0L,0.0L);
        printf("%15.7Lf %15.7Lf %15.7Lf %15.7Lf %15.7Lf %15.7Lf %15.7Lf %15.7Lf %15.7Lf %15.7Lf %15.7Lf %15.7Lf\n",0.0L,0.0L,0.0L,0.0L,0.0L,0.0L,sqr(x[i]),sqr(y[i]),x[i],y[i],x[i]*y[i],1.0L);
    }
    for (i=0;i<n;i++)
        printf("%15.7Lf\n%15.7Lf\n",xx[i],yy[i]);

    gpl();
    return 0;
}

