//#include <windows.h>
using namespace std ;
bool check_increasing(int a[]){
// cout << "INCREASING " <<endl ;
for(int i = 0 ; i < 10 -1; i++){
// cout << "cmparing : " << a[i] << " < " << a[i+1] <<endl ;
if( a[i] > a[i+1] ) return false ;
}
return true ;
}
bool check_decreasing(int a[]){
for(int i = 0 ; i < 10-1 ; i++){
// cout << "cmparing : " << a[i] << " > " << a[i+1] <<endl ;
if( a[i] < a[i+1] ) return false ;
}
return true ;
}
int main(){
/*
int test1[] = {100, 88 , 65, 43 ,34,2003,11,7,6,5} ;
int test2[] = {1,2,3,4,5,2,7,8,9,10} ;
int test3[] = {13 ,25, 39, 40, 55 ,62, 68, 77, 88, 95 } ;
int test4[] = {88, 62, 77, 20, 40, 10, 99, 56, 45, 36 } ;
int test5[] = {91 ,78, 61, 59, 54, 49, 43, 33, 26, 18} ;
/*
3
13 25 39 40 55 62 68 77 88 95
88 62 77 20 40 10 99 56 45 36
91 78 61 59 54 49 43 33 26 18
bool x = check_decreasing(test5);
if(x) cout << "decre" <<endl ;
else cout << "wrong" <<endl ;
bool y = check_increasing(test3);
if(y) cout << "increasing " <<endl ;
else cout << "wrong" <<endl ;
*/
// Sleep(20000) ;
int N ;
cin >> N ;
cout << "Lumberjacks:" <<endl ;
for(int i = 0 ; i < N ; i++){
int beards[10] = {0} ;
for(int j = 0 ; j < 10 ; j++){
cin >> beards[j] ;
}
bool inc = check_increasing(beards) ;
bool dec = check_decreasing(beards) ;
if(inc || dec) cout << "Ordered"<<endl;
else cout << "Unordered"<<endl;
}
// Sleep(20000) ;
}