// Arup Guha
// 6/2/2026
// Solution to Gnome Sequencing
// https://open.kattis.com/problems/gnomesequencing

using namespace std;
#include <bits/stdc++.h>

int main() {

    int nC;
    cin >> nC;

    // Header.
    cout << "Gnomes:" << endl;

    // Process cases.
    for (int loop=0; loop<nC; loop++) {

        // Read in three gnomes.
        int g1, g2, g3;
        cin >> g1 >> g2 >> g3;

        // Assume it's okay.
        bool okay = true;

        // Two ways it could fail.
        if (g2 < g1 && g2 < g3) okay = false;
        if (g2 > g1 && g2 > g3) okay = false;

        // Output accordingly.
        if (okay) cout << "Ordered" << endl;
        else      cout << "Unordered" << endl;
    }

    return 0;
}
