#include <iostream>;
using namespace std;
bool isAs(int a[], int len){
for(int i = 0; i < len -1; i++){
if(a[i] > a[i+1]){
return false;
}
}
return true;
}
bool isDec(int a[], int len){
for(int i = 0; i < len -1; i++){
if(a[i] < a[i+1]){
return false;
}
}
return true;
}
int main(){
int n, lumberjack;
cin >> n;
int lumber[10];
for(int i = 0; i < n; i++){
for(int jack = 0; jack < 10; jack++){
cin >> lumberjack;
lumber[jack] = lumberjack;
}
if(i == 0){
cout << "Lumberjacks:" << endl;
}
if(isAs(lumber, 10) || isDec(lumber, 10)){
cout << "Ordered" << endl;
} else {
cout << "Unordered" << endl;
}
}
return 0;
}