Go: // 九九を出すだけ
package main
import (
	"fmt"
	"os"
	"bufio"
)
var out = bufio.NewWriter(os.Stdout)

func main(){
	defer out.Flush()
	for i:=1; i<10; i++{
		for j:=1; j<10; j++{
			fmt.Fprintf(out, "%dx%d=%d\n", i, j, i*j)
		}
	}
}

C++: #define DEBUG_ON
#define CONDITION true
using namespace std;/*{{{*/

#include <algorithm>
#include <cassert>
#include <cctype>
#include <climits>
#include <cmath>
#include <complex>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <iostream>
#include <iterator>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <sys/time.h>
#include <vector>

#define INF (1e9)
static const double PI (3.14159265358979323846);
static const double EPS (1e-10);

typedef long long int ll;
typedef unsigned long long int ull;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<string> vs;
typedef pair<int, int> pii;
typedef complex<double> P;

inline int toInt(string s) {int v; istringstream sin(s);sin>>v;return v;}
template<class T> inline string toString(T x) {ostringstream sout;sout<<x;return sout.str();}
inline double now(){ struct timeval tv; gettimeofday(&tv, NULL); return ((double)(tv.tv_sec) + (double)(tv.tv_usec) * 1e-6); }

#define FOR(i, b, e) for (typeof(b) i = (b); assert((i) <= (e)), i != (e); ++i)
#define REP(i, n) FOR(i, 0, n)

#define IFC(c) if(c) continue;
#define IFB(c) if(c) break;
#define IFR(c, r) if(c) return r;

#define OPOVER(_op, _type) inline bool operator _op (const _type &t) const

#define arrsz(a) ( sizeof(a) / sizeof(a[0]) )

#define F first
#define S second
#define MP(a, b) make_pair(a, b)

#define SZ(a) ((ll)a.size())
#define PB(e) push_back(e)
#define SORT(v) sort((v).begin(), (v).end())
#define RSORT(v) sort((v).rbegin(), (v).rend())

#define ALL(a) (a).begin(), (a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define EACH(c,it) for(__typeof((c).begin()) it=(c).begin(); it!=(c).end(); ++it)
#define EXIST(s,e) ((s).find(e)!=(s).end())

#define BIT(n) (1ULL << (n))
#define BITOF(n, m) ((n) >> (m) & 1)

#define RANGE(a, b, c) ((a) <= (b) && (b) <= (c))

#ifdef DEBUG_ON
#define dprt(fmt, ...) if (CONDITION) fprintf(stderr, fmt, __VA_ARGS__)
#define darr(a) if (CONDITION) copy( (a), (a) + arrsz(a), ostream_iterator<int>(cerr, " ") ); cerr << endl
#define darr_range(a, f, t) if (CONDITION) copy( (a) + (f), (a) + (t), ostream_iterator<int>(cerr, " ") ); cerr << endl
#define dvec(v) if (CONDITION) copy( ALL(v), ostream_iterator<int>(cerr, " ") ); cerr << endl
#define darr2(a, n, m) if (CONDITION) FOR(i, 0, (n)){ darr_range( (a)[i], 0, (m) ); }
#define dvec2(v) if (CONDITION) FOR(i, 0, SZ(v)){ dvec( (v)[i] ); }
#define WAIT() if (CONDITION) { string _wait_; cerr << "(hit return to continue)" << endl; getline(cin, _wait_); }
#else
#define cerr if(0) cerr
#define dprt(fmt, ...)
#define darr(a)
#define darr_range(a, f, t)
#define dvec(v)
#define darr2(a, n, m)
#define dvec2(v)
#define WAIT()
#endif
/*}}}*/

int main(int argc, char const* argv[])
{
	FOR (i, 1, 10) {
		FOR (j, 1, 10) {
			cout << toString(i) << "x" << toString(j) << "=" << i * j << endl;
		}
	}
	return 0;
}

C++: #include<iostream>
using std::cout;
using std::endl;

int main()
{
	for (int x = 1; x <= 9; x++)
	{
		for (int y = 1; y <= 9; y++)
		{
			cout << x << "??" << y << "???" << x*y << endl;
		}
	}
		return 0;
}

C++: #include<iostream>
#include <stdio.h>
using namespace std;

int main(){
    int i;
    int j;
    for( i = 1; i<10; i++){
        for( j = 1; j<10; j++){
            printf("%dx%d=%d\n",i,j,i*j);


        }


    }


    return 0;
}

C++: #include<cstdio>
#include<cstring>
#include<algorithm>
#include<queue>
#include<vector>
#include<cassert>
#define N 510
#define M 8000000
#define oo 0x3f3f3f3f
using namespace std;

struct node
{
    int x,y;

    node (){}
    node (int a,int b):x(a),y(b){}
};

queue<node>que;
queue<int>que1;
vector<node>vec[N*N];
char map[N][N],mark[N*N];
int color[N][N],cntC;
int first[N],next[N*N*8],end[N*N*8],cnt_edge;
int d[2][N*N],step[N][N];
int mx[8]={1,-1,0,0,1,1,-1,-1},my[8]={0,0,1,-1,1,-1,1,-1};
int n,m;

void addEdge(int u,int v)
{
	end[cnt_edge]=v;
	next[cnt_edge]=first[u];
	first[u]=cnt_edge++;
}

void dfs(int x,int y)
{
	int i,nx,ny;

	color[x][y]=cntC;
	vec[cntC].push_back(node(x,y));

	for (i=0;i<8;i++)
	{
		nx=x+mx[i];
		ny=y+my[i];

		if (nx>=0&&nx<n&&ny>=0&&ny<m&&map[nx][ny]==map[x][y]&&color[nx][ny]==0)
			dfs(nx,ny);
	}
}

void bfs1(int st,int dis[])
{
	int u,v,i;

	memset(mark,0,sizeof(mark));
	for (i=1;i<=cntC;i++)
		dis[i]=oo;
	dis[st]=0;
	mark[st]=1;
	que1.push(st);
	while (!que1.empty())
	{
		u=que1.front();
		que1.pop();

		for (i=first[u];i;i=next[i])
		{
			v=end[i];
			if (mark[v]==0)
			{
				dis[v]=dis[u]+1;
				mark[v]=1;
				que1.push(v);
			}
		}
	}
}

void bfs(node st)
{
	node u,v;
	int i;

	memset(step,0,sizeof(step));
	step[st.x][st.y]=1;
	que.push(st);

	while (!que.empty())
	{
		u=que.front();
		que.pop();

		for (i=0;i<8;i++)
		{
			v.x=u.x+mx[i];
			v.y=u.y+my[i];

			if (v.x>=0&&v.x<n&&v.y>=0&&v.y<m&&map[v.x][v.y]!='0'&&
				step[v.x][v.y]==0&&d[0][color[v.x][v.y]]<=d[0][color[u.x][u.y]])
			{
				step[v.x][v.y]=step[u.x][u.y]+1;
				que.push(v);
			}
		}
	}
}


int main()
{
    int i,j,k,x,y,nx,ny,ans_d,ans_s;
    node st,en;

    scanf("%d%d",&n,&m);
    scanf("%d%d%d%d",&st.x,&st.y,&en.x,&en.y);
    st.x--;
    st.y--;
    en.x--;
    en.y--;

    for (i=0;i<n;i++)
       scanf("%s",map[i]);

	memset(color,0,sizeof(color));
	cntC=0;
	for (i=0;i<n;i++)
		for (j=0;j<m;j++)
			if (color[i][j]==0&&map[i][j]!='0')
			{
				cntC++;
				dfs(i,j);
			}

	memset(first,0,sizeof(first));
	cnt_edge=1;
	for (i=0;i<n;i++)
		for (j=0;j<m;j++)
			if (color[i][j])
			{
				for (k=0;k<8;k++)
				{
					x=i+mx[k];
					y=j+my[k];

					if (x>=0&&x<n&&y>=0&&y<m&&color[x][y]!=color[i][j]&&color[x][y]!=0)
						addEdge(color[i][j],color[x][y]);
				}
			}

	bfs1(color[st.x][st.y],d[0]);
	//bfs1(color[en.x][en.y],d[1]);
	ans_d=d[0][color[en.x][en.y]];
	if (ans_d==oo)
	{
		printf("0 0\n");
		return 0;
	}

	/*
	memset(map,0,sizeof(map));
	for (i=1;i<=cntC;i++)
		if (d[0][i]+d[1][i]==ans_d)
		{
			for (j=0;j<vec[i].size();j++)
				map[vec[i][j].x][vec[i][j].y]=1;
		}
	*/

	bfs(en);
	ans_s=step[st.x][st.y];
	//assert(ans_s>0);

	printf("%d %d\n",ans_s,ans_d);

    return 0;
}

C++: #include<stdio.h>

int main()
{
	int a[9], b[9];
	for(int i = 0;i < 9;i++)
	{
		a[i] = i + 1;
		
		for(int j = 0;j < 9;j++)
		{
			b[j] = j + 1;
			printf("%dx%d=%d\n",a[i],b[j],a[i]*b[j]);
		}
	}

	return 0;
}

C++: #include<iostream>
#include<cmath>
#include<string>
#include<cctype>
#include<vector>
using namespace std;
int main(){
        for(int i=1;i<10;i++){
                for(int j=1;j<10;j++){
                        printf("%dx%d=%d\n",i,j,i*j);
                }
        }
        return 0;
}

C++: #include <iostream>
using namespace std;

int main(void) {
	int ans;
	for (int i = 1; i < 10; i++) {
		for (int j = 1; j < 10; j++) {
			ans = i*j;
			cout << i << "x" << j << "=" << ans << endl;
		}
	}

	return 0;
}

C++: #include<stdio.h>
int main(){
int a,b;
for(a=1;a<10;a++){
for(b=1;b<10;b++){
printf("%dx%d=%d\n",a,b,a*b);
}
}
return 0;
}