// Arup Guha
// 9/16/2012
// Solution to 2009 MCPC Problem B: Gnome Sequencing

import java.util.*;

public class b {

	public static void main(String[] args) {

		Scanner stdin = new Scanner(System.in);
		int n = stdin.nextInt();

		// Process cases.
		System.out.println("Gnomes:");
		for (int loop=0; loop<n; loop++) {

			// Get three values.
			int a = stdin.nextInt();
			int b = stdin.nextInt();
			int c = stdin.nextInt();

			// Hard code two checks for order.
			if (a < b && b < c)
				System.out.println("Ordered");
			else if (a > b && b > c)
				System.out.println("Ordered");
			else
				System.out.println("Unordered");
		}
	}
}