// Arup Guha
// 8/22/2015
// Solution to 2015 UCF Locals Problem: Medal Ranking (medal)

import java.util.*;

public class medal implements Comparable<medal> {

	// All of these help us processing the result.
	final public static String[] RESULT = {"none","count","color","both"};
	final public static int COUNT_MASK = 1;
	final public static int COLOR_MASK = 2;

	public int gold;
	public int silver;
	public int bronze;

	public medal(int g, int s, int b) {
		gold = g;
		silver = s;
		bronze = b;
	}

	// Comparison based on golds, then silver, then bronze.
	public int compareTo(medal other) {
		if (this.gold != other.gold) return this.gold-other.gold;
		if (this.silver != other.silver) return this.silver-other.silver;
		return this.bronze-other.bronze;
	}

	// Returns the total medal count.
	public int count() {
		return gold+silver+bronze;
	}

	public String toString() {
		return gold+" "+silver+" "+bronze;
	}

	public static void main(String[] args) {

		Scanner stdin = new Scanner(System.in);
		int numCases = stdin.nextInt();

		// Go through each case.
		for (int loop=0; loop<numCases; loop++) {

			int mask = 0;

			// Create objects for both US and Russia.
			medal usa = new medal(stdin.nextInt(), stdin.nextInt(), stdin.nextInt());
			medal russia = new medal(stdin.nextInt(), stdin.nextInt(), stdin.nextInt());

			// Check which way(s) the US wins!
			if (usa.count() > russia.count()) mask |= COUNT_MASK;
			if (usa.compareTo(russia) > 0) mask |= COLOR_MASK;

			// Output the appropriate result.
			System.out.println(usa+" "+russia);
			System.out.println(RESULT[mask]);
			System.out.println();
		}
	}
}