import java.util.*;
import java.io.*;

/**
* ACM Problem #11639 (Guard the Land)
*
* @author Felix Dietrich
* @version 1.0, 31/07/09
*
* Status : Accepted
*/
class Main
{
static BufferedReader br = new BufferedReader(new InputStreamReader(System.in));

public static void main(String... args) throws IOException
{
String input;
int n;

while ((input = br.readLine()) != null)
{
if (input.length() < 1)
continue;

n = Integer.parseInt(input.trim());

if (n < 0)
return;
work(n);
}
}

static int casenumber = 1;

public static void work(int n) throws IOException
{
String input;
StringTokenizer st;
Guard g1, g2;
int strongsec;
int weaksec;

while (n > 0)
{
input = br.readLine();
st = new StringTokenizer(input);
g1 = new Guard(st.nextToken(), st.nextToken(), st.nextToken(), st.nextToken());

input = br.readLine();
st = new StringTokenizer(input);
g2 = new Guard(st.nextToken(), st.nextToken(), st.nextToken(), st.nextToken());

strongsec = Guard.securedArea(g1, g2);
weaksec = g1.area() + g2.area() - 2*strongsec;
printNumber(strongsec, weaksec, 10000 - (strongsec + weaksec));
n--;
}
casenumber = 1;
}

public static class Guard
{
final int x1, y1, x2, y2;

public Guard(String x1, String y1, String x2, String y2)
{
this.x1 = Integer.parseInt(x1);
this.x2 = Integer.parseInt(x2);
this.y1 = Integer.parseInt(y1);
this.y2 = Integer.parseInt(y2);
}

public int area()
{
return (x2 - x1) * (y2 - y1);
}

public static int securedArea(Guard g1, Guard g2)
{
//g1 left of g2
if (g1.x1 < g2.x1 && g1.x2 <= g2.x1)
return 0;
//g2 left of g1
if (g1.x1 > g2.x1 && g2.x2 <= g1.x1)
return 0;
//g1 under g2
if (g1.y1 < g2.y1 && g1.y2 <= g2.y1)
return 0;
//g2 under g1
if (g1.y1 > g2.y1 && g2.y2 <= g1.y1)
return 0;

int maxx1 = Math.max(g1.x1, g2.x1);
int minx2 = Math.min(g1.x2, g2.x2);
int maxy1 = Math.max(g1.y1, g2.y1);
int miny2 = Math.min(g1.y2, g2.y2);

return (minx2 - maxx1) * (miny2 - maxy1);
}
}

private static void printNumber(int i, int j, int k)
{
System.out.println(String.format("Night %d: %d %d %d", casenumber, i, j, k));
casenumber++;
}
}