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

class Finder {

    int[][] tiles;
    // ...
    public Finder() {
	tiles = new int[6][3];
	// ...
    }

    public void initTiles(String s) {
	String[] lst = s.split(" ");
	for(int i=0;i<6;i++) {
	    tiles[i][0] = Integer.parseInt(lst[3*i]);
	    tiles[i][1] = Integer.parseInt(lst[3*i+1]);
	    tiles[i][2] = Integer.parseInt(lst[3*i+2]);
	}
    }
    
    int getMax() {
	int max;
	/* a completer */
	
	return max;
    }

    // ...
}


class Triominhaut {

    public static void main(String[] args) {
	Locale.setDefault(Locale.ENGLISH);

	Finder f = new Finder();

	try {
	    BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
	    String line = "";
       
	    line = br.readLine();
	    int nb = Integer.parseInt(line);
	    for(int i=0;i<nb;i++) {
		line = br.readLine();
		f.initTiles(line);
		System.out.println(f.getMax());
	    }
	}
	catch(IOException e) {}	
    }
}
