#include #include #include #include #define N 11 using namespace std; struct Node { char map[10][N]; int flag; }; char endstate[10][N]; Node t1,t2,t3; int n,i,j,k; bool isEnd(Node tt) { for(i=0;i qu; if(isEnd(t1)) { printf("Preserved\n"); return; } t1.flag=0; qu.push(t1); while(!qu.empty()) { t2=qu.front(); qu.pop(); if(t2.flag==0) { t1.flag=1; rt90(); if(isEnd(t1)) { printf("Rotated through 90 degrees\n"); return; } rt180(); if(isEnd(t1)) { printf("Rotated through 180 degrees\n"); return; } rt270(); if(isEnd(t1)) { printf("Rotated through 270 degrees\n"); return; } reflect(); if(isEnd(t1)) { printf("Reflected\n"); return; } qu.push(t1); } else if(t2.flag==1) { rt90(); if(isEnd(t1)) { printf("Reflected and rotated through 90 degrees\n"); return; } rt180(); if(isEnd(t1)) { printf("Reflected and rotated through 180 degrees\n"); return; } rt270(); if(isEnd(t1)) { printf("Reflected and rotated through 270 degrees\n"); return; } printf("Improper\n"); } } } int main() { while(scanf("%d",&n)&&n!=0) { for(i=0;i