//* Problem  : H: Stake Your Claim
//* Contest  : ECNA-2006
//* Type     : Solution
//* Date     : 2008.08.04
//* Author   : alt
//* Language : C++
//* Compiler : Microsoft Visual C++ 6.0

#include <stdio.h>
#include <math.h>
#include <string.h>
#include <stdlib.h>
#include <vector>
#include <queue>
#include <string>
#include <stack>
#include <set>
#include <map>
#include <algorithm>

using namespace std;

typedef pair <int,int> PIII;
typedef vector <int> VI;
typedef vector <vector<int> > VVI;
typedef vector <pair<int,int> > VPII;
typedef vector <vector<pair<int,int> > > VVPII;

#define int64 long long
#define PI (2.0 * acos(0.0))
#define MP make_pair
#define PB push_back
#define SZ(a) (int)a.size()
#define FOR(i, n) for (int i = 0; i < (int)n; i++)
#define FORSZ(i, a) FOR(i, SZ(a))
#define FORE(i, a, b) for (int i = (int)(a); i <= (int)(b); i++)
#define FORR(i, a, b) for (int i = (int)(a); i >= int(b); i--)
#define INF 1000000000
#define INFL 1000000000000000000LL
#define ALL(a) a.begin(), a.end()
#define RALL(a) a.rbegin(), a.rend()

inline int si(){int tt; scanf("%d", &tt); return tt;}

vector <string> a;

int res_x, res_y, res, n;

vector <string> aa;

int who;

int x[16], y[16];

int dfs(int x, int y, int val)
{
	if (aa[x][y] != val) return 0;
	aa[x][y] = '#';
	int res = 1;
	if (x) res += dfs(x - 1, y, val);
	if (y) res += dfs(x, y - 1, val);
	if (x != n-1) res += dfs(x + 1, y, val);
	if (y != n-1) res += dfs(x, y + 1, val);
	return res;
}

int check()
{
	aa.assign(ALL(a));
	int maxx[2] = {0,0};
	FOR(i,n)FOR(j,n)
		if (aa[i][j] != '#')
		{
			int v = aa[i][j] - '0';
			maxx[v] = max(maxx[v], dfs(i,j, v+'0'));
		}
	return maxx[who] - maxx[1-who];
}

int dp[2][4*4*4*4*4*4*4*4*4*4];

int f[2][4*4*4*4*4*4*4*4*4*4];

int total;

int move(int player, int mask, int cnt)
{
	if (cnt == total) return check();

	if (!f[player][mask])
	{
		int res = (player == who) ? (-INF) : (INF);
		FOR(i, total)
			if ((mask & (1<<(i+i))) == 0 && ((mask & (1<<(i+i+1))) == 0))
			{
				a[x[i]][y[i]] = player + '0';
				int t = move(1 - player, mask + (1<<(i+i)) * (player+2), cnt + 1);
				if (player == who)
					res = max(res, t);
				else
					res = min(res, t);
				a[x[i]][y[i]] = '.';
			}
		dp[player][mask] = res;
		f[player][mask] = 1;
	}
	return dp[player][mask];
}

void solve()
{
	memset(f, 0, sizeof(f));
	res = -INF; total = 0;
	int left = 0, c0 = 0, c1 = 0;
	FOR(i,n) FOR(j,n) 
	{
		if (a[i][j] == '.')
		{
			x[left] = i;
			y[left++] = j;
		}
		c0 += a[i][j] == '0';
		c1 += a[i][j] == '1';
	}
	who = (c0 > c1);

	int mask = (1 << left) - 1;

	total = left;

	for (int i = 0; i < total; i++)
	{
		a[x[i]][y[i]] = who + '0';
		int tt = move(1 - who, (1<<(i+i)) * (who+2), 1);
		if (tt > res)
		{
			res = tt;
			res_x = x[i];
			res_y = y[i];
		}
		a[x[i]][y[i]] = '.';
	}
}

void result()
{
	printf("(%d,%d) %d\n", res_x, res_y, res);
}

int main()
{
#ifdef _DEBUG
	freopen("1064", "r", stdin);
//	freopen("1064w", "w", stdout);
#endif
//	freopen("1064", "r", stdin);
	//freopen("1064w", "w", stdout);
	while (scanf("%d", &n) && n)
	{
		a.clear();
		FOR(i, n) {char s[100]; scanf("%s", s); a.PB(string(s));}
		solve();
		result();
	}
	return 0;
}

