Problem:
Problem I: Mysterious Onslaught

In 2012, human beings have been exposed to fierce onslaught of unidentified mysterious extra-terrestrial creatures. We have exhaused because of the long war and can't regist against them any longer. Only you, an excellent wizard, can save us. Yes, it's time to stand up!

The enemies are dispatched to the earth with being aligned like an n * n square. Appearently some of them have already lost their fighting capabilities for some unexpected reason. You have invented a highest grade magic spell 'MYON' to defeat them all. An attack of this magic covers any rectangles (which is parallel to axis). Once you cast a spell "myon," then all the enemies which the magic covers will lose their fighting capabilities because of tremendous power of the magic. However, the magic seems to activate enemies' self-repairing circuit. Therefore if any enemy which have already lost its fighting capability is exposed to the magic, the enemy repossesses its fighting capability. You will win the war when all the enemies will lose their fighting capabilities.

Let me show an example. An array of enemies below have dispatched:

1 1 1 1 1
1 0 0 0 1
1 0 1 0 1
1 0 0 0 1
1 1 1 1 1

Here, '0' means an enemy that doesn't possess fighting capability, and '1' means an enemy that possesses.
First, you cast a spell "myon" with covering all the enemies, which results in;

0 0 0 0 0
0 1 1 1 0
0 1 0 1 0
0 1 1 1 0
0 0 0 0 0

Next, cast once again with covering central 3 * 3 enemies.

0 0 0 0 0
0 0 0 0 0
0 0 1 0 0
0 0 0 0 0
0 0 0 0 0

Now you can defeat them all by casting a spell covers remaining one. Therefore you can cast "myonmyonmyon," which is the shortest spell for this case.

You are given the information of the array. Please write a program that generates the shortest spell that can defeat them all.

Input

The first line of each test case has an integer n. Following n lines are information of an array of enemies. The format is same as described in the problem statement.

Input terminates when n = 0.
You may assume that one or more enemy have fighting capability.

Output

For each dataset, output the shortest spell.

Constraints

1 ≤ n ≤ 5

Sample Input

5
1 1 1 1 1
1 0 0 0 1
1 0 1 0 1
1 0 0 0 1
1 1 1 1 1
3
1 1 1
1 1 1
1 1 1
5
1 1 1 1 0
1 1 1 1 0
1 0 0 0 1
0 1 1 1 1
0 1 1 1 1
0

Output for the Sample Input

myonmyonmyon
myon
myonmyon

Solution in C++ (judge verdict: Wrong Answer)

#include <iostream>
#include <vector>
#include <map>
#include <queue>
#include <algorithm>
using namespace std;

// dp[n-1][bits] := 最小のmyonの回数
vector<char> dp[4];

// (x,y) の値(0 or 1) を返す
int get(int n, int bits, int x, int y){
	return ((bits & (1 << (x+y*n))) > 0 );
}

void debug(int bits, int n){
	cout << "[debug]" << endl;
	for(int y=0 ; y < n ; y++ ){
		for(int x=0 ; x < n ; x++ ){
			cout << get(n,bits,x,y);
		}
		cout << endl;
	}
	cout << endl;
}

// [(sx,sy),(gx,gy)] の範囲に myon をかける (0 <=> 1 の反転)
int myon(int bits, int n, int sx, int sy, int gx, int gy){
	for(int y = sy ; y <= gy ; y++ ){
		for(int x = sx ; x <= gx ; x++ ){
			int k = 1 << (x+y*n);
			(bits & k)? bits -= k : bits += k;
		}
	}
	return bits;
}

pair<int,int> up_left(int bits, int n){
	int mx = 5, my = 5;
	for(int y=0 ; y < n ; y++ ){
		for(int x=0 ; x < n ; x++ ){
			if( get(n,bits,x,y) ){
				mx = min( mx , x );
				my = min( my , y );
			}
		}
	}
	return pair<int,int> (mx,my);
}

// n = 3 のときのすべての状態からの最小の myon の回数を計算する
// n*n のすべて 0 の状態からBFS
void solve_N3(int n){
	queue< pair<int,char> > q;
	q.push( pair<int,char>( 0 , 0 ) );
	map<int,bool> memo;
	
	while( !q.empty() ){
		int bits = q.front().first; 
		char cnt = q.front().second;
		q.pop();
		if( memo[bits] ) continue;
		memo[bits] = true;
		dp[n-1][bits] = cnt;
		
		for(int y = 0 ; y < n ; y++ ){
			for(int x = 0 ; x < n ; x++ ){
				for(int my = y ; my < n ; my++ ){
					for(int mx = x ; mx < n ; mx++){
						int next = myon( bits , n , x , y , mx , my );
						if( !memo[next] ){
							q.push( pair<int,char>( next , cnt+1 ) );
						}
					}
				}
			}
		}
	}
}

// n <= 3 のすべての解を求めておく
void solve(){
	for(int i=1 ; i <= 4 ; i++ ){
		if( i == 1 ){
			vector<char> v(2);
			v[0] = 0;
			v[1] = 1;
			dp[0] = v;
		}else if( i == 2 ){
			vector<char> v(16);
			int f[16] = {0,1,1,1,1,1,2,2,1,2,1,2,1,2,2,1};
			for(int j=0 ; j < 16 ; j++ ){
				v[j] = f[j];
			}
			dp[1] = v;
		}else if( i == 3 ){
			dp[2] = vector<char>(512);
			solve_N3( 3 );
		}else if( i == 4 ){
			dp[3] = vector<char>(65536);
			solve_N3( 4 );
		}
	}
}

int main(){
	// n <= 3 のすべての解を求めておく
	solve();
	string s[5] = { "" , "myon" , "myonmyon", "myonmyonmyon", "myonmyonmyonmyon"};
	
	cout << "end;" << endl;
	
	int n;
	while( cin >> n , n ){
		int bits = 0;
		
		for(int i=0 ; i < n*n ; i++ ){
			int b;
			cin >> b;
			bits |= (b << i);
		}
		
		debug( bits , n );
		
		int ans = 0;
		if( n <= 3 ){
			cout << s[ dp[n-1][bits] ] << endl;
		}else if( n == 4 ){
			cout << "hoge" << endl;
		}else if( n == 5 ){
			cout << "hoge" << endl;
		}
	}
}